You need a custom 4D Write Pro toolbar for your application but you’re concerned it might take too much time to implement it? Good news, with 4D v16 R4 standard actions can now be assigned to checkboxes and pop-up menus. Save time with this ready-to-use feature and easily create a user-friendly interface perfectly matching your needs!
You can now create a pop-up menu to control the font size or the border style for your 4D Write Pro area just in one click, no code needed! Just assign the action using the property list and it’s done. And the object status and value will be automatically updated by 4D depending on the context and text selection! Simple and powerful…
The standard action mechanism has first been expanded in 4D v16 R3 to include 4D Write Pro actions. This mechanism has now been extended again, so that more form objects support it. In fact, with 4D v16 R4, standard actions can be assigned to the following type of objects:
Using standard actions to create your custom toolbar, has two main benefits:
Object activation/deactivation is automatically handled by 4D depending on the context. Easy! For example, a checkbox for “bold” is automatically active if text is selected and deactivated when the selection is a picture.
The current status (for checkboxes) or value (for pop-up menus) is automatically updated by 4D according to the current text selection. If the selected text is bold then the checkbox is set. It is unset for not bold or marked as tri-state if mixed. No coding needed!
Take a look at this video; it shows how to use standard actions to create a simple 4D Write Pro toolbar and how the toolbar reacts when the user selects some text:
Automatic pop-up menu
Standard action mechanism takes full meaning when it comes to 4D Write Pro. Let’s say you want to create a pop-up menu in your toolbar in order to set the border style. Just assign the borderStyle standard action in the property list and it’s done!
4D will internally automatically create an array and fill it with the appropriate items in the current application language! Moreover, the selected element in the menu will be automatically updated according to the current selected text.
Custom hierarchical pop-up menu
You can also easily create your own custom hierarchical pop-up menu with standard actions. To do so, we just have to create a hierarchical list and assign a standard action to each item.
It can be done using the new option in the List Editor as shown below:
Of course you can also define everything by code, if you need to build the user interface dynamically:
// Creation of new list
// Creation of the font size list
APPEND TO LIST($fontSizes;"10";11)
APPEND TO LIST($fontSizes;"12";21)
APPEND TO LIST($fontSizes;"14";31)
// Add standard actions to the properties of the font size list
SET LIST ITEM PARAMETER($fontSizes;11;Associated standard action;"fontSize?value=10pt")
SET LIST ITEM PARAMETER($fontSizes;21;Associated standard action;"fontSize?value=12pt")
SET LIST ITEM PARAMETER($fontSizes;31;Associated standard action;"fontSize?value=14pt")
$ref:=OBJECT SET LIST BY REFERENCE(*;"Popup Dropdown List";Choice list;$fontSizes)