IMetabaseSaveDialog.SaveObject

Syntax

SaveObject: 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.

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 a new ID 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.

See also:

IMetabaseSaveDialog