Allocating Repository Object in Workspace

Executing the example requires that repository contains a workspace with the WSP identifier. It is also required that repository contains calendar dictionary with the CALENDAR identifier.

Add links to the Andy, Metabase, Workspace system assemblies.

Sub UserProc;
Var
    ws: IWxWorkspace;
    MB: IMetabase;
    MbObj: IMetabaseObject;
    Shape: IWxShape;
    WxObj: IWxMetabaseObject;
    Style: IWxStyle;
Begin
    Mb := MetabaseClass.Active;
    ws := Mb.ItemById("WSP").Edit As IWxWorkspace;
    MbObj := Mb.ItemById("CALENDAR"As IMetabaseObject;
    ws.BeginUpdate;
    Shape := ws.CreateRectangle;
    Shape.CreateExtension("KeWsp.WxMetabaseObject");
    WxObj := Shape.Extension As IWxMetaBaseObject;
    WxObj.MetabaseObject := MbObj;
    Shape.Id := "Dim";
    //create style
    Style := ws.CreateStyle;
    Style.LinePenTransparent := 100;
    Style.PictureAlignmentVertical := GxAlignment.Center;
    Style.TextAlignmentVertical := GxAlignment.Far;
    Style.TextFontStyleItalic := True;
    Shape.Style := Style;
    ws.EndUpdate;
    (ws As IMetabaseObject).Save;
End Sub UserProc;

After executing the example a repository object with the CALENDAR identifier is allocated in a workspace, to which the defined style is applied:

When allocating a repository object in a workspace, remember that it will have an icon and a name displayed for it.

See also:

Examples