4D v18 R3 brings new standard actions to 4D Write Pro. They target tables and their elements (i.e., rows and cells). These actions let you to define a table’s border, a cell’s background color, the vertical alignment of the text in a row, as well as the alignment of the table itself in the document … just to name a few. All standard actions are accessible either through simple buttons, dropdown lists, or menus or through a few short lines of code. Want more? The menus are automatically adapted to the user’s language! Plus, tables, buttons, lists, and menus are automatically activated or deactivated depending on the user’s current selection. This saves developers a lot of time!
available actions
The available actions for tables, rows, and cells are numerous. For example, border thickness, styles, and colors, as well as background color, margins, and horizontal alignment (for the table) … in addition to inner margins and vertical alignment (for the cells).
How to proceed? Look no further than … the standard action field in the Property List.
Lists
In a dropdown list, for example, enter “table/borderWidth” or “table/borderStyle” or “table/backgroundColor” and they’ll automatically be filled with the possible values for each attribute.
Buttons
For a button, you just need to specify the value to assign to it after the property.
table/borderWidth?value=4pt
Menus
To create a menu that allows you to change the thickness, style, and color of the borders, the following few lines of code are all you need:
// create the menu
$menu:=Create menu
// add items
APPEND MENU ITEM($menu;ak standard action title)
SET MENU ITEM PROPERTY($menu;-1;Associated standard action;"table/borderWidth")
APPEND MENU ITEM($menu;ak standard action title)
SET MENU ITEM PROPERTY($menu;-1;Associated standard action;"table/borderStyle")
APPEND MENU ITEM($menu;ak standard action title)
SET MENU ITEM PROPERTY($menu;-1;Associated standard action;"table/borderColor")
// call the menu
$s:=Dynamic pop up menu($menu)
What about rows and cells?
Easy! Just replace the “table” prefix by “row” or “cell“.
cell/borderColor?value=red.
And columns?
A quick note about columns. The concept of columns is relatively abstract because, technically, they don’t exist in tables … they contain only rows and cells. However, to make standard actions commonplace, they can also be used on columns! Just know that the properties will not be applied to the columns (since they do not exist!) but to each of their cells.
column/verticalAlignment?value=bottom
Updated 4D Write Pro interface
Thanks to these standard actions, we’re pleased to announce that the 4D Write Pro interface has been greatly enhanced in terms of table processing possibilities. Four new buttons have been added for changing the appearance of tables, rows, columns, and cells:
For more information, have a look at the documentation and have fun!