mbRegisterAction
mbRegisterAction(
t_viewType
t_uniqueId
t_name
t_callback
t_enableCB
[ ?iconFile g_iconFile ]
[ ?icon g_icon ]
[ ?checkable g_checkable ]
[ ?checkedCB t_checkedCB ]
)
=> o_action / nil
Description
Creates an action and registers it with the menu builder for future retrieval and use within menus. This action will appear only when mbSetContextData is used to set its visibility location.
Arguments
|
t_viewType
|
Name of the view type for which this action has been registered.
|
|
t_uniqueId
|
Unique ID for the reference action.
|
|
t_name
|
Name of the registered action.
|
|
t_callback
|
Function called when the action is selected.
|
|
t_enableCB
|
Function to determine if the action is enabled or disabled. This function is called each time a menu is mapped, and allows a decision whether the menu will gray out or not at the time of menu mapping.
Function returns t if the action is enabled and returns nil if the action is disabled.
|
|
?iconFile g_iconFile
|
|
|
Name of the icon associated with the action.
|
|
?icon g_icon
|
Icon associated with the action. The function reads the icon file from the share/cds/icons directory in the installation path.
|
|
?checkable g_checkable
|
|
|
Allows the action to appear with a check box.
|
|
?checkedCB t_checkedCB
|
|
|
Function called each time the status of the check box is changed.
|
Values Returned
|
o_action
|
ID of the action that is created and registered.
|
|
nil
|
Returned when no action is created and its registration fails.
|
Example
mbRegisterAction("maskLayout" "del" "Delete" "leHiDelete()" "geGetSelSet() && t" ?icon "delete.png")
mbSetContextData("maskLayout" "del" "Shape Instance" "Navigator Canvas" "Common")
Returns del.
The menu will appear only if you have something selected on the canvas or in the navigator.
Return to top