Defining action views in forms
How to define action views that will fire action events.
Actions views are form items that can be activated to fire an action event. The action event
triggers user code in an ON ACTION
block.
We distinguish action views defined explicitly in form files from default action views. A default action
view will automatically appear when an action handler is implemented in the current dialog (if no
explicit action view with the same name exists in the form). Default action view creation can be
controlled with the DEFAULTVIEW
action attribute.
To fire user code, action views are bound to action handlers by name.
Action view decoration attributes (IMAGE
for icons, TEXT
for
label, COMMENT
for hint) can be centralized in action defaults.
TOOLBAR
items (toolbar
buttons) or TOPMENU
options:TOOLBAR
ITEM accept
ITEM cancel
...
END
Action views can be typical BUTTON
items defined in the form LAYOUT
:
LAYOUT
GRID
{
[b1 ]
...
}
...
ATTRIBUTES
BUTTON b1 : print, IMAGE="printer";
...
Action views can be sub-elements of other elements, as when defining a BUTTONEDIT
with an
ACTION
attribute:
LAYOUT
GRID
{
[f1 ]
...
}
...
ATTRIBUTES
BUTTONEDIT f1 = customer.cust_city, ACTION=choose_city, IMAGE="zoom";
...
Action views can also be simple IMAGE
items, when the ACTION
attribute is specified:
LAYOUT
GRID
{
[i1 ]
...
}
...
ATTRIBUTES
IMAGE i1: image1, ACTION=show_details, IMAGE="mylogo";
...
IMAGE
fields can be defined as TABLE
columns and
define the ACTION
attribute to trigger user code:LAYOUT
GRID
{
<TABLE t1 >
[c1 |c2 |c3 ]
[c1 |c2 |c3 ]
[c1 |c2 |c3 ]
...
}
...
ATTRIBUTES
...
IMAGE c3: FORMONLY.image, ACTION=delete;
...
For more details about image column actions see Image columns firing actions.
TABLE
(or TREE
) will be considered an action view when
defining the DOUBLECLICK
attribute:DISPLAY ARRAY arr TO sr.*
ATTRIBUTES(UNBUFFERED, DOUBLECLICK=select)
...
END DISPLAY
AUTOCOMMANDS
placeholder, and in toolbars with the AUTOITEMS
placeholders. Use the
CONTENT=ACTIONS
attribute to specify that a list of actions views must be
rendered:TOPMENU
...
AUTOCOMMANDS (CONTENT=ACTIONS)
...
TOOLBAR
...
AUTOITEMS (CONTENT=ACTIONS)
...