The row choice in the DISPLAY ARRAY dialog can be associated
with a dedicated action.
When using a
DISPLAY ARRAY dialog to control a table view with a graphical
front-end, by default, a double-click on a row (for a desktop client), or a
tap on a row (for mobile clients) has the following behavior:
- On a desktop front-end, by default, a mouse double-click changes
the current row, and fires the "accept" action if available.
If the default accept action is fired, the dialog will end,
except if the accept action has been disabled or was
over-written by a ON ACTION accept handler.
This default behavior fits most of the record list of a
desktop application, where the main purpose is to let the
user choose a row from the list.
- On a mobile devices, by default, a tap on a row changes the
current row only. This corresponds to a single mouse click
on a desktop front-end, and therefore does not fire the
"accept" action by default. If a tap must fire the accept
action, define the DOUBLECLICK
attribute.
In order to detect the physical event when the user chooses a row with a double-click on desktop
clients and tap on mobile clients, define the DOUBLECLICK
attribute of DISPLAY ARRAY dialogs to fire an action
handler block (ON ACTION
double-click-action-name):
DISPLAY ARRAY arr TO sr.*
ATTRIBUTES(UNBUFFERED, DOUBLECLICK=select)
ON ACTION select
MESSAGE "myselect:", arr_curr()
END DISPLAY
If the
DOUBLECLICK attribute is defined, it will only configure
the action for the double-click or tap physical event: By default, the
accept action is still available, and the [Ok] button or the [Return] key
will still fire the accept action and leave the dialog. To avoid the default
accept action, add
ACCEPT=FALSE to the
DISPLAY
ARRAY attribute
list:
DISPLAY ARRAY arr TO sr.*
ATTRIBUTES(UNBUFFERED, DOUBLECLICK=select, ACCEPT=FALSE)
ON ACTION select
MESSAGE "myselect:", arr_curr()
END DISPLAY
Note that if the selected row is not the current row, any defined
AFTER
ROW and
BEFORE ROW control blocks execute
before the
ON ACTION block. The code blocks execute in the
following order:
- AFTER ROW (for the previous current row)
- BEFORE ROW (for the new current row)
- ON ACTION
double-click-action
When defining a DOUBLECLICK action, you declare an explicit action view,
and no default action
view will be displayed for this action (except if you explicitely force it with
DEFAULTVIEW=YES).
The double-click action can also be defined as
TABLE/TREE attribute in form
files. DOUBLECLICK in DISPLAY ARRAY
attributes has a higher precedence as DOUBLECLICK in the
form file. For more details, see DOUBLECLICK attribute.