Image columns firing actions
Columns in tables displaying images can trigger action events, when the user selects the image.
TABLE and TREE containers can define columns as
IMAGE field, to display pictures or icons. By default, these table
cells are not clickable. When you define an ACTION attribute for a
table column defined as IMAGE, the action event will fire when the
image is selected (with a mouse click, for example). Note that this does not apply
to the IMAGECOLUMN concept, which is rather a column decoration.
Important: When selecting an image, the current row may change as when selecting a
new row in the table.
The following example defines a TABLE with two IMAGE
columns, and attaches the update and delete
actions:
LAYOUT
TABLE
{
[c1 |c2 |i1|i2]
[c1 |c2 |i1|i2]
[c1 |c2 |i1|i2]
}
END
END
ATTRIBUTES
EDIT c1 = FORMONLY.id, TITLE="Id", NOENTRY;
EDIT c2 = FORMONLY.name, TITLE="Name";
IMAGE i1 = FORMONLY.i_modify, ACTION=update;
IMAGE i2 = FORMONLY.i_delete, ACTION=delete;
END
INSTRUCTIONS
SCREEN RECORD sr(FORMONLY.*);
END
In the program code, use a dialog instruction to implement the action handlers for the
image actions. For example, you can define a
DISPLAY ARRAY with
ON UPDATE and ON DELETE list modification triggers
that will respectively create the update and delete
actions:DISPLAY ARRAY arr TO sr.*
ON UPDATE
-- user code
ON DELETE
-- use code
END DISPLAY