Allocating Repository Object in Workspace

Executing the example requires an existing ws object of the IWxWorkspace type.

Sub UserProc;

Var

ws : IWxWorkspace;

MB: IMetabase;

MbObj : IMetabaseObject;

Shape : IWxShape;

WxObj : IWxMetabaseObject;

Style : IWxStyle;

Begin

ws.BeginUpdate;

 

Mb := MetabaseClass.Active;

MbObj := Mb.ItemById("CALENDAR") As IMetabaseObject;

Shape := ws.CreateRectangle;

Shape.CreateExtension("KeWsp.WxMetabaseObject");

WxObj := Shape.Extension As IWxMetaBaseObject;

WxObj.MetabaseObject := MbObj;

Shape.Id := "Dim";

 

//creating a style

Style := ws.CreateStyle;

Style.LinePenTransparent := 100;

Style.PictureAlignmentVertical := GxAlignment.Center;

Style.TextAlignmentVertical := GxAlignment.Far;

Style.TextFontStyleItalic := True;

Shape.Style := Style;

 

ws.EndUpdate;

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