OnCreateCommandBars - cCJCommandBarSystem
Event called when the command bar system is being paged (created)
Type: Event
Syntax
Procedure OnCreateCommandBars
Description
OnCreateCommandBars is called as part of the menu, toolbar and statusbar activation process. When a commandbar system is activated the COM object is created and the OnCreateCommandBars event is called. This is called as part of the CreateCommandBars method. It is called after the cCJCommandBarSystem COM object is created and initialized and before any of the child COM objects (menubars, toolbars, menu items, statusbar, statusbar pane) are created.
This event can be used to set COM properties that are not exposed directly in the property panel.
Sample
This sample shows how you can use this event. We will set custom sizes for large and small images in the toolbars and the menus. To do this, we must use the cCJCommandBarsOptions object and set properties within this object. We can use the OptionsObject method to gain access to the options object.
We will also enable tab workspaces. To do this, we must get a pointer to this object and bind it to a new created cCJTabWorkspace object. We set the needed properties and then destroy this proxy object. This provides a good example of the use of automation objects where you 1) create a proxy object, 2) get a dispatch pointer to the COM object, 3) bind the COM object to the proxy object, 4) send COM messages to the proxy object, 5) destroy the proxy object.
Object oCommandBarSystem is a cCJCommandBarSystem
Property Boolean pbTabWorkspace True
:
Procedure OnCreateCommandBars
Handle hoOptions
Forward Send OnCreateCommandBars
Get OptionsObject to hoOptions
// set custom sizes for the menu and toolbar images
Send ComSetIconSize of hoOptions False 24 24 // small icons
Send ComSetIconSize of hoOptions True 36 36 // large icons
Send ComSetPopupIconSize of hoOptions 24 24 // popup icons
// turn on the tab workspace bar
Send DisplayTabWorkspace
End_Procedure
Procedure DisplayTabWorkspace
Variant vTab
Handle hoTab
Boolean bShow
If (IsComObjectCreated(Self)) Begin
Get pbTabWorkspace to bShow
Get Create U_cCJTabWorkspace to hoTab
Get ComShowTabWorkspace bShow to vTab
Set pvComObject of hoTab to vTab
Set ComFlags of hoTab to xtpWorkspaceHideAll
Send destroy of hoTab
Send ComRecalcLayout
End
End_Procedure
:
End_Object