Form FIELD - < form_item >() ... [Pro]
Form FIELD <form_item>("Form identifier","Field name","Field type","Default value","Variable to save field value",Column) Available in: Professional edition
|
This command adds a field to a form.
|
#
|
Parameter name
|
Parameter description
|
1
|
Form identifier
|
An identifier of the form (for example, "FM1") to which the item will be added.
|
2
|
Field name
|
The label that appears above the control in the form window.
|
3
|
Field type
|
Item type can be one of these: "LIST" - selection from list of values defined as a string of values delimited by | character. Example: Item1|Item2|Item3 "EDIT" - edit control (single line) "EDIT_ML5" - edit control (5 lines) "EDIT_ML10" - edit control (10 lines) "CHECK" - check box button "LINE" - static line "TEXT" - static text "BUTTON" - button "PWD" - password input box "RADIO" - radio button "EDIT_FILE" - file path "EDIT_FOLDER" - folder path
|
4
|
Default value
|
Defines default the value (the value that initially appears in the form). Check button (CHECK) and radio button (RADIO) have YES or NO values.
|
5
|
Variable to save field value
|
Variable that receives the data (value) the user enters. Check button (CHECK) and radio button (RADIO) have YES or NO values. If the item type is "LIST" then there is automatically created also variable that contains index of the item selected. For example, if the variable to receive selected "LIST" value is "vListValue" then - after the form is closed by user by clicking OK button - there is also variable "vListValue_Inx" that contains index of the item selected. The index numbers start from 0.
|
6
|
Column
|
|
|
|
Example (Macro Steps):
|
1
|
<#> <#> This example shows how to use form commands
|
2
|
Macro execution: ONLY COMMANDS
|
3
|
Form FIELD "This is a simple calculator for: + - * /" of type "Static text" (Default value=0, Variable to save field value=, Form identifier=FM1)
|
4
|
Form FIELD "" of type "Separator" (Default value=0, Variable to save field value=, Form identifier=FM1)
|
5
|
Form FIELD "Operand 1:" of type "Text edit" (Default value=0, Variable to save field value=vOper1, Form identifier=FM1)
|
6
|
Form FIELD "Operation:" of type "Drop down list" (Default value=Plus|Minus|Multiply|Divide, Variable to save field value=vOperation, Form identifier=FM1)
|
7
|
Form FIELD "Operand 2:" of type "Text edit" (Default value=0, Variable to save field value=vOper2, Form identifier=FM1)
|
8
|
Form FIELD "" of type "Separator" (Default value=0, Variable to save field value=, Form identifier=FM1)
|
9
|
Form FIELD "Continue ?" of type "Check box" (Default value=YES, Variable to save field value=vAgain, Form identifier=FM1)
|
10
|
Jump TARGET "lbl_Again"
|
11
|
Form OPEN "FM1", Window title="Simple Calculator"
|
12
|
IF STRING _vCanceled==1
|
13
|
Macro EXIT
|
14
|
ENDIF
|
15
|
IF STRING vOperation==Plus
|
16
|
Variable SET "vOper1=EXPR(%vOper1%+%vOper2%)", Message text=""
|
17
|
ENDIF
|
18
|
IF STRING vOperation==Minus
|
19
|
Variable SET "vOper1=EXPR(%vOper1%-%vOper2%)", Message text=""
|
20
|
ENDIF
|
21
|
IF STRING vOperation==Multiply
|
22
|
Variable SET "vOper1=EXPR(%vOper1%*%vOper2%)", Message text=""
|
23
|
ENDIF
|
24
|
IF STRING vOperation==Divide
|
25
|
Variable SET "vOper1=EXPR03(%vOper1%/%vOper2%)", Message text=""
|
26
|
ENDIF
|
27
|
Message SHOW "Information" : "vOper1" (other parameters: x = -100, y = -100, Window title = The result is:, Buttons = OK, Timeout (seconds) = , Always on top = ).
|
28
|
IF STRING vAgain==YES
|
29
|
Jump TO "lbl_Again"
|
30
|
ENDIF
|
|
Example (Plain Text):
<#> This example shows how to use form commands
<cmds>
<form_item>("FM1","This is a simple calculator for: + - * /","TEXT","0","",1)
<form_item>("FM1","","LINE","0","",1)
<form_item>("FM1","Operand 1:","EDIT","0","vOper1",1)
<form_item>("FM1","Operation:","LIST","Plus|Minus|Multiply|Divide","vOperation",1)
<form_item>("FM1","Operand 2:","EDIT","0","vOper2",1)
<form_item>("FM1","","LINE","0","",1)
<form_item>("FM1","Continue ?","CHECK","YES","vAgain",1)
<label>("lbl_Again")
<form_show>("FM1","Simple Calculator","calc.exe",0,500,0,,,1,1)
<if_str>("_vCanceled==1") <exitmacro> <endif>
<if_str>("vOperation==Plus")<#>
<varset>("vOper1=EXPR(%vOper1%+%vOper2%)","")
<endif>
<if_str>("vOperation==Minus")
<varset>("vOper1=EXPR(%vOper1%-%vOper2%)","")
<endif>
<if_str>("vOperation==Multiply")
<varset>("vOper1=EXPR(%vOper1%*%vOper2%)","")
<endif>
<if_str>("vOperation==Divide")
<varset>("vOper1=EXPR03(%vOper1%/%vOper2%)","")
<endif>
<msg>(-100,-100,"vOper1","The result is:",1,,0)
<if_str>("vAgain==YES")
<goto>("lbl_Again")
<endif>