Skip to content

Context Menus

Context menus are normally not placed inside the cCJCommandBarSystem object. They are usually located near the object that uses them or at the desktop level so all objects can use them. Context menus must be able to determine which command bar system they belong to. By default, a context menu will assume it belongs to the main MDI command bar system. This can be overridden by setting the phoCommandBars property of the cCJContextMenu.

Most classes have a Floating_Menu_Object property that can be set to the handle of a context menu. When set, pressing the right mouse button will invoke the context menu. Therefore, an object (or objects) can be assigned a custom context menu by creating the context menu and setting the Floating_Menu_Object property.

Object oSpecialContextMenu is a cCJContextMenu
    Object oCutMenuItem is a cCJCutMenuItem
    End_Object

    Object oCopyMenuItem is a cCJCopyMenuItem
    End_Object

    Object oPasteMenuItem is a cCJPasteMenuItem
        Set pbControlBeginGroup to True
    End_Object

    Object oDeleteItem is a cCJDeleteEditMenuItem
        Set pbControlBeginGroup to True
    End_Object
End_Object

Object oForm is a Form
    Set Floating_Menu_Object to oSpecialContextMenu
    :
End_Object

Two global context menus should be included at the desktop in most projects by including the packages oEditContextMenu.pkg and oDEOEditContextMenu.pkg. These create two context menus: a standard-control context menu and a Data Entry Object (DEO) control context menu. The standard-control menu is assigned to the Default_Form_Floating_Menu_ID global variable, which makes it the default context menu for non-data aware forms (Form, Grid, etc.). The DEO-control menu is assigned to the Default_dbFloating_Menu_ID global variable, which makes it the default context menu for data aware forms (dbForm, dbGrid, etc.). These standard context menus are made available as follows:

Object oApplication is a cApplication
    Set peHelpType to htHtmlHelp
End_Object  // oApplication

Use oEditContextMenu.pkg
Use oDEOEditContextMenu.pkg

Object oMain is a Panel
    :
End_Object

See Also