Skip to content

OnCreate - cCJAbstractCommandBar

Event is called when a menubar or toolbar COM object is created

Type: Event

Syntax

Procedure OnCreate

Description

The OnCreate event is called when a menubar of toolbar COM object is created. At this point this object is bound to the COM object. This event can be used to send messages to the COM object allowing for special customizations not supported directly by other design-time properties.

See CreateComInstance for a description of the menubar / toolbar COM object creation process

Sample

In this sample OnCreate has been augmented to show text below icons for just this one toolbar. Normally you'd set this for all toolbars by setting the cCJCommandBarSystem's pbShowTextBelowIcons but in this example we apply this just to the one toolbar.

We also restrict docking to top, bottom and floating (no left or right). The pbEnableDocking property only allows you to enable or disable all docking.

Both of these are rather usual custom behaviors, which is why non COM properties were not created for them. This is a good example, of using the Codejock COM interface, which allows you to do whatever you want.

Procedure OnCreate 
    Forward Send OnCreate

    // only allow top, bottom and floating docking. 
    Send ComEnableDocking (xtpFlagAlignTop ior xtpFlagAlignBottom ior xtpFlagFloating)

    // show text below icons for this one toolbar.
    Set ComShowTextBelowIcons to True

End_Procedure