Skip to content

The Additional Codejock Interfaces and Classes

The most commonly needed Codejock properties and methods have been exposed as easier-to-use high-level interfaces in the command bar classes. This was done to facilitate visual designing and to make coding easier. Most of your development needs will be ably handled by the high-level interfaces provided. If you need to access the Codejock class interfaces, they are all available as “Com” messages (e.g., ComSetIconSize). These messages can only be sent after the control is created. A number of post-COM control create events are provided for this purpose (e.g., OnCreate, OnCreateCommandBars, OnCreateAction, OnCreateControl).

The following sample shows how to use COM messages that were not exposed at a higher level. When the command bar system is created, the OnCreateCommandBars event is called after the COM control is created. We will use that to set custom sizes for large and small images in the toolbars and the menus. This is not something you would normally need to do, so there is no design-time level interface for this.

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
End_Procedure

The following example shows how you could create a method to show or hide the Codejock tab-workspace bar. Once the command bar system is activated, it can be called at any time to show or hide the tab workspace. This property and procedure would get added to your cCJCommandBarSystem object.

// We must define a property to support this.
Property Boolean pbShowTabWorkspace False

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

This could be controlled by creating a checkbox menu item as follows:

Object oTabWorkSpaceMenu is a cCJMenuItem
    Set psCaption to "&Tab Workspace"
    Set psToolTip to "Tab Workspace"
    Set psDescription to "Add or Remove the tab workspace"

    Procedure OnExecute
        Boolean bOn
        Handle oCommandBar

        Get CommandBarSystem to oCommandBar
        Get pbTabWorkspace of oCommandBar to bOn
        Set pbTabWorkspace of oCommandBar to (not(bOn))
        Send DisplayTabWorkspace of oCommandBar
    End_Procedure

    Function IsChecked Returns Boolean
        Boolean bOn
        Handle oCommandBar

        Get CommandBarSystem to oCommandBar
        Get pbTabWorkspace of oCommandBar to bOn
        Function_Return bOn
    End_Function
End_Object

The Codejock classes contain additional controls, such as the ribbon bar controls, that are not wrapped in higher-level DataFlex classes. These classes are available. Using them will require that the developer familiarize themselves with the Codejock COM interface and how this is used by the DataFlex high-level classes.

Note that high-level classes are available for the tab toolbar control (cCJTabToolbar, cCJTabControlItem), but they are currently not visually modeled in the Studio.

See Also