Tech Tip: New Standard Actions for 4D Write Pro
PRODUCT: 4D | VERSION: 16R3 | PLATFORM: Mac & Win
Published On: June 30, 2017
4D v16R3 introduces improvements to 4D Write Pro. A major improvement is the release of a number of new standard actions that have been created for 4D Write Pro in mind. These standard actions are easily assigned to menus and buttons like typical standard actions. These actions allow typical word processing application functions such as text formating and modifying the format of the document.
There are many ways to set up standard actions. Two of the ways that have been typically used are applying them to a menu or a button.
For a menu actions can be set by code using the SET MENU ITEM PROPERTY command:
SET MENU ITEM PROPERTY($menuRef_l;$menuItem_l;Associated standard action;ak copy) |
or through the menu editor in the Toolbox:
For a button or object that can execute standard actions, the standard actions can be set through code using the OBJECT SET ACTION command:
OBJECT SET ACTION(*;"buttonName";ak copy) |
or through the object's properties list in the Form Editor:
4D v16R3 introduces a new command to execute standard actions from code and a method. This command is the INVOKE ACTION command. Which takes in the name of the action as a string for the first parameter and the optional parameter to a constant to select the target on where to execute the method. There are two choices for the target the current form in which the action is called from performed in a synchrnous manner or the main form in which the front most document or dialog in the process executes the action in an asynchronous manner.
The INVOKE ACTION command also came with a set of constants to contain the name of standard actions. These constants all start with the ak identifier. This will allow for the command to remain consistent even if the name of the standard action changes.
Example of using copy:
INVOKE ACTION(ak copy;ak current form) |