Skip to content

CreateCommandBars - cCJCommandBarSystem

Builds the entire COM command bar system (menus, toolbars, statusbar)

Type: Procedure

Syntax

Procedure CreateCommandBars

Call Example

Send CreateCommandBars

Description

When the cCJCommandBarSystem object is activated, the entire COM menu, toolbar and statusbar system must be created. CreateCommandBars performs this task.

As with any COM active/x object, the COM object is not actually created until the proxy DataFlex object is activated. The OnCreate event is always sent right after the COM object is created. In the cCJCommandBarSystem class the OnCreate event is used to build the entire system. It does this be sending the message CreateCommandBars. You will never send this message yourself and you will rarely augment it. It is worth understanding what the CreateCommandBars method actually does.

CreateCommandBars does the following:

  1. The COM commandbar system connects to the rest of the objects. It determines what its owner parent is, it determines if this is a MDI menu, and if so, it determines what the clientarea object is.

  2. It takes all of the non COM cCJCommandBarSystem properties (e.g., peVisualTheme) and sets their appropriate COM counterparts (e.g. ComVisualTheme).

  3. It sends the event OnCreateCommandBars. This is typically the event you will use to customize this process. This is called after the cCJCommandBarSystem object has been created and initialized but before the child menubar, toolbars or statusbar objects have been created.

  4. It builds menus, toolbars and a statusbar based on the contents of its child objects. It does this by broadcasting the message CreateComInstance to all children. These child objects (cCJMenuBar, cCJToolBar, cStatusBar) will create their COM object counterparts and then build their child objects by sending the message CreateComInstance. When this is complete, the initial menu, toolbar and statusbar structure, based on your object nesting structure will be created.

  5. It calls LoadEnvironment. This is used to optionally restore a layout (position of toolbars, etc.) based on peRestoreLayout.

  6. It starts the idle timer if pbTimerUpdate is true.

Therefore, augmenting CreateCommandBars before forward sending the message gives you control of the commandbar system immediately after the commandbar COM class has been created but before it has been initialized. Augmenting CreateCommandBars after forward sending the message gives you control of the commandbar system after the entire menu/toolbar/statusbar system has been created.

Note

The message ReleaseComObject is called when the commandbar system object is deactivated.

Note

The OnCreate method in the cCJCommandBarSystem object is used to build the objects. This method should be considered to be private and should not be augmented. Use OnCreateCommandBars or augment CreateCommandBars.