IMetabaseSaveDialog.SaveObject

Fore Syntax

SaveObject: IMetabaseObjectDescriptor;

Fore.NET Syntax

SaveObject: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor;

Description

The SaveObject property determines description of the repository object to be saved.

Comments

If this property is set, a dialog box for saving a selected object with new identifier and name is opened. Identifier and name are generated automatically on initializing the dialog box. The user may choose existing object in the dialog box that is overwritten.

Fore Example

Executing the example requires a form with the Button1 button and the MetabaseSaveDialog component named MetabaseSaveDialog1. The repository contains an object with the UserObject identifier.

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        MB: IMetabase;
        MObjDesc: IMetabaseObjectDescriptor;
        ClassFilter: IMetabaseDialogClassFilter;
        Filters: IMetabaseDialogFilters;
        i: Integer;
    Begin
        MB := MetabaseClass.Active;
        //Object that should be saved
        //with new identifier and name
        MObjDesc := MB.ItemById("UserObject");
        //Filter for possibility to save object in existing object
        //of the same class
        ClassFilter := New MetabaseDialogClassFilter.Create;
        ClassFilter.ObjectClass := MetabaseClass.GetMetabaseObjectClass(MObjDesc.ClassId);
        Filters := MetabaseSaveDialog1.Filters;
        i := Filters.AddFilter(ClassFilter);
        MetabaseSaveDialog1.FilterIndex := i;
        //Directive of saving object
        MetabaseSaveDialog1.SaveObject := MObjDesc;
        MetabaseSaveDialog1.Execute(Self);
    End Sub Button1OnClick;

After executing the example click the button and a dialog box for saving the specified object with a new identifier and name is displayed. You may choose existing objects of the same class in the dialog box.

Fore.NET Example

Executing the example requires a .NET form with the Button1 button and the MetabaseSaveDialogNet component named MetabaseSaveDialogNet1. The repository contains an object with the UserObject identifier.

    Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
    Var
        MB: IMetabase;
        MBClass: MetabaseClassClass = New MetabaseClassClass();
        MObjDesc: IMetabaseObjectDescriptor;
        ClassFilter: IMetabaseDialogClassFilter;
        Filters: IMetabaseDialogFilters;
        i: integer;
    Begin
        MB := Self.Metabase;
        //Object that should be saved
        //with new identifier and name
        MObjDesc := MB.ItemById["UserObject"];
        //Filter for possibility to save object in existing object
        //of the same class
        ClassFilter := New MetabaseDialogClassFilter();
        ClassFilter.ObjectClass := MBClass.GetMetabaseObjectClass(MObjDesc.ClassId);
        Filters := MetabaseSaveDialogNet1.Filters;
        i := Filters.AddFilter(ClassFilter);
        MetabaseSaveDialogNet1.FilterIndex := i;
        //Directive of saving object
        MetabaseSaveDialogNet1.SaveObject := MObjDesc;
        MetabaseSaveDialogNet1.Execute(Self);
    End Sub;

After executing the example click the button and the dialog box for saving the specified object with a new identifier and name is displayed. You may choose existing objects of the same class in the dialog box.

See also:

IMetabaseSaveDialog