company logo

Action definition (1)

Mainly, the action definition consists of action type and action name.

In addition, an action path may be defined in order to send the action to another control. Mainly, one may chose between function and window actions. There are also project actions, but those cannot be called from within an application but are passed as parameter when calling the GUI framework.

Action

The action is defined by type and name. In order to define a function action, ACT_Function has to be selected from the action type list. Function actions have to be implemented with the name used as function name in the context class associated with the executing resource. The executing resource is determined by means of the action path. By default, it is the control the action is associated with.

Thus, the same action may be implemented differently for different controls without changing the action definition. How to define function actions is described in Defining function actions.

There is also a set of default actions described in Action reference.

When defining a window action (ACT_Window), the a window action (ADA_Window) has to be defined (Window action definition). Window actions are global objects with unique names. The window action either defines its own data source, or it inherits the data source from the executing resource.

When defining complex actions containing group and/or sub menus, the action type is usually set to ACT_undefined. One may, however, also associate complex actions with a function or window action, which may act as kind of default action when clicking the action.

The action type ACT_undefined may also be set in order to deactivate an action item. This has the same effect as disabling the event action control, but it cannot be enabled by application.

Action path

In case of function actions, which are defined in a context class of a resource, the executing resource need not to be the same as the action calling resource. E.g. associating an action with an edit control, one may define a button in the parent window (e.g. turn content into capital letters). When clicking the button, the action may be passed to the edit control via the (field) Path defined for the action. In this case, the action is called in the context of the window, but implemented in the context class of the edit control.

In order to define a path, bubble type should be set to ABT_local (or ABT_undefined). In all other cases, the path will be ignored. The path is a field path, which may start with any number of '.', where each dot causes to go up one level in the control hierarchy.

In order to send the action to any parent control that has implemented the action, ABT_parent (send action to next higher control) or ABT_upwards (send action to all controls in the parent hierarchy, until an action returns a value not equal to -1 (this is also returned, when action is not implemented). By returning -1, one may also execute the action implemented in several control context classes in the hierarchy.

In order to send the action to another control, one may either define a bubble type or a field path.


Subtopics

  1. Action design