hiCreateAction
hiCreateAction(
?name s_name
[ ?callback t_callback ]
[ ?icon g_icon ]
[ ?iconText t_iconText ]
[ ?toolTip t_tooltip ]
[ ?enabled g_enabled ]
[ ?checkable g_checkable ]
[ ?checked g_checked ]
[ ?defAction g_defaultAction ]
[ ?actionList l_actionList ]
[ ?statusTip t_statusTip ]
[ ?useNameForIconText g_useNameForIconText ]
)
=> o_action
Description
Creates an action for a toolbar or menu. An action is a toolbar or menu item that, when clicked, triggers a callback. Actions are typically used for common commands that are added to multiple places in the user interface, such as toolbars and menus. An action present in both a toolbar and a menu remains synchronized. For example, if it is selected from the toolbar, the corresponding menu item is also checked.
Actions can have sub-actions that are displayed in a drop-down list (in a toolbar) or a submenu (in a menu). Use the ?actionList argument to create sub-actions.
Actions can be checkable. Checkable actions are toggle items; they can remain pressed (on a toolbar) or display a check box (on a menu) to visually indicate that they are currently selected. Use the ?checkable argument to create these toggle actions.
For callbacks to work correctly, you must specify either the ?callback or ?actionList argument. If a callback is specified, it is triggered when the action is clicked. If a callback is not specified, then the ?defaultAction specified is used if it is on the action list. If the default action is not on the action list, then the first item in the action list is used.
Arguments
|
?name s_name
|
Symbol specifying a name for the action. After action for the toolbar item is created, you can change its visibility by setting the invisible property.
|
|
?callback t_callback
|
|
|
The callback function is triggered when the action is clicked.
|
|
?icon g_icon
|
The icon is displayed for the action.
After the toolbar is created, you can change the icon with the hiIcon property. For example:
windowID->hiToolbars->toolbarName->actionName->hiIcon = “EditIcon.gif”
|
|
?iconText t_iconText
|
|
|
The text that is displayed for the action. t_iconText is displayed if g_icon is not specified or is nil.
After the toolbar is created, you can change the text with the hiIconText property. For example:
windowID->hiToolbars->toolbarName->actionName->hiIconText = “Edit Mode”
|
|
?toolTip t_tooltip
|
|
|
The tooltip for the action that is displayed when the pointer hovers over it.
After the toolbar is created, you can change the tooltip with the hiToolTip property. For example:
windowID->hiToolbars->toolbarName->actionName->hiToolTip = “Sets mode”
|
|
?enabled g_enabled
|
|
|
Enables the specified action. The default value is t.
After the toolbar is created, you can use the enabled property to enable or disable it. For example:
windowID->hiToolbars->toolbarName->actionName->enabled = t
|
|
?checkable g_checkable
|
|
|
Enables the action to be checkable, that is, if you want it to be a toggle item. A checkable item remains pressed (on a toolbar) or has a check-mark next to it (on a menu) when it is selected.
|
|
?checked g_checked
|
|
|
Checks the action initially.
|
|
?defAction g_defaultAction
|
|
|
The default action for the action list. This argument is used if ?callback is not specified.
After the toolbar is created, you can use the defaultAction property to set the default action. For example:
windowID->hiToolbars->toolbarName->actionName->defaultAction = t
|
|
?actionList l_actionList
|
|
|
List containing the sub-actions for an action. Each element in the list can be a non-checkable action created with hiCreateAction or a separator created with hiCreateToolbarSeparator. There is no restriction on uncheckable sub-actions.
This list of choices appears as a drop-down list on a toolbar or as a submenu of the action on a menu.
After the toolbar is created, you can use the actionList property to set the action list. For example:
windowID->hiToolbars->toolbarName->actionName->actionList = newActionlist
A sub-action is a property of its parent action. For example, to access a sub-action from a pull-down menu, you can have:
mypulldown->toplevel_action->sub_action->checked
mypulldown->toplevel_action->sub_action->enabled
|
|
?statusTip t_statusTip
|
|
|
Displays the status text in the status bar at the bottom of the window when the mouse hovers over the action. If you do not specify this argument, the action’s text (t_iconText) is displayed.
?useNameForIconText g_useNameForIconText
When an action is instantiated, the ?iconText argument, if unspecified or is an empty string, is set to the print name of ?name if and only if g_useNameForIconText is not nil. If this argument is nil, and the ?iconText argument is not specified or is an empty string, the tool button shows an icon without text. The default value is t.
|
Value Returned
|
o_action
|
The handle to the action.
|
Examples
new=hiCreateAction( ?name ’new ?iconText "New" ?callback "newCBFunction" )
hiAddToolbarItem( toolbar new )
0R
hiAddMenuItem( menu new )
OR
hiCreatePulldownMenu( ’file "File" list ( new ) )
Related Topics
Toolbar Functions
hiSetActionChecked
hiSetActionChecked
hiCreateToolbarTypein
Return to top