Skip to content

HeaderContextMenu - cCJGridColumn

Used to provide a custom header context menu for this column. Passes default context menu, returns actual menu to use.

Type: Function
Return Data Type: Handle

Parameters

Parameter Type Description
hoMenu Handle Handle to default header context menu to use as determined by the Grid object

Syntax

Function HeaderContextMenu Handle hoMenu Returns Handle

Call Example

Get HeaderContextMenu hoMenu to HandleVariable

Description

The HeaderContextMenu function provides a way to customize your header context menus. It is passed a default context menu, as provided by the grid, and by default, it returns this handle. You can augment this function to return a different context menu or none at all (return 0). This allows you to provide custom menus at a column level.

When the user right-clicks on a column header, the following occurs:

  1. The grid gets a handle to a header context menu, which is stored in phoHeaderContextMenu.

  2. If a column was selected, HeaderContextMenu is sent to the appropriate column object, passing the default context menu. This function returns the context menu to actually use. If it is 0, the process ends.

  3. The phoContextMenuColumn is set to the column, which can be used by the context menu to determine which column was selected.

  4. A context menu is invoked using the handle returned from HeaderContextMenu.

By default, HeaderContextMenu looks like this and just returns the passed context menu handle:

Function HeaderContextMenu Handle hoMenu Returns Handle
    Function_Return hoMenu
End_Function

If you wished to assign a custom context menu to a column, you would do something like this:

Function HeaderContextMenu Handle hoMenu Returns Handle
    Function_Return oMyCustomHeaderContxtMenu
End_Function

If you wished to have no context menu for this column, you would return 0.

Function HeaderContextMenu Handle hoMenu Returns Handle
    Function_Return 0
End_Function

Note that HeaderContextMenu is called and a header context menu can be invoked without changing the cell focus. In addition cell focus does not need to be enabled (cCJGrid.pbFocusSubItems) and the column does not need to be focusable (pbFocusable) to receive this message.

Data cell context menus use a similar process with the ContextMenu function.

Return Value

Handle to header context menu to use. If 0, no menu is invoked.