The power of dynamic forms was introduced with 4D v16 R6, allowing you to build your forms on the fly by building them in an object or loading them from a text file. This is very convenient in a world where forms are frequently changed to meet an application’s needs.
In 4D, the entry order typically follows a z order for both binary and dynamic forms. With 4D v17 R6, you can now define an entry order that’s not necessarily associated with the z order.
For each page in your form definition, you have the “objects” attribute containing a list of form elements arranged according to the z order. A new “entryOrder” attribute has been added to let you specify your own customized entry order. If this attribute is undefined, 4D will use the z order (the order defined in the “objects” attribute).
Here’s an example of a dynamic form with two input fields and a button:
// Create inputs and button
$text1:=New object("type";"input"; "top";20; "left";140; "width";100; "height";18)
$text2:=New object("type";"input"; "top";20; "left";20; "width";100; "height";18)
$button:=New object("type";"button"; "text";"OK"; "top";60; "left";140; "width";100; "height";20)
// Create entry order collection
$entryOrder:=New Collection("text2";"text1")
// Create page with form objects and entry order
$page:=New object("objects";New object("text1";$text1; "text2";$text2; "button";$button); "entryOrder";$entryOrder)
// Create form
$form:=New object("pages"; New collection(Null;$page); "windowTitle";"My form"; "rightMargin";20; "bottomMargin";20)
// Load the form
$w:=Open form window($form)
DIALOG($form)
This can be represented as:
{
"pages": [
null,
{
"objects": {
"text1": {
"type": "input",
"top": 20, "left": 140,
"width": 100, "height": 18,
"events": ["onClick"]
},
"text2": {
"type": "input",
"top": 20, "left": 20,
"width": 20, "height": 18,
"events": ["onClick"]
},
"button": {
"type": "button",
"text": "OK",
"top": 60, "left": 140,
"width": 20, "height": 20,
"events": ["onClick"]
}
},
"entryOrder": [
"text2",
"text1"
]
}
]
}
