SaveObject: IMetabaseObjectDescriptor;
The SaveObject property determines description of the repository object to be saved.
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.
Executing the example requires a form with a button named Button1 and the MetabaseSaveDialog component named MetabaseSaveDialog1. The repository contains an object with the OBJECT identifier.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
MObjDesc: IMetabaseObjectDescriptor;
ClassFilter: IMetabaseDialogClassFilter;
Filters: IMetabaseDialogFilters;
i: Integer;
Begin
MB := MetabaseClass.Active;
// Object that must be saved
// with new identifier and name
MObjDesc := MB.ItemById("OBJECT");
//Filter for saving 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;
// Specify saved 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: