Promotic

InputBox - method of the Pm object

Description:
Setting the value by the user (by means of the input window) of one or more variables (variables of the array type).
This method is obsolete (but functional) and it is better to use the PmForm object.
Syntax:
Boolean InputBox(String sDlgTitle, String sDlgStyle, Variant vItemValue, Variant vItemName, Variant vItemType, [Variant vItemAttr1], [Variant vItemAttr2])
Parameters:
sDlgTitle(String) Title of the input window
sDlgStyle(String) Style of the window. Example: "left:100;top:200;z-order:topmost;button-cancel:no;"
left - Position of the left window side relative to the whole screen (in pixels). For the position definition can be used, for example, PmgObject.ScreenX or PmaPanel.ScreenX property.
right - Position of the right window side relative to the whole screen (in pixels). Don't set if left is specified. If left nor right is not specified, then the window will be centered horizontally.
top - Position of the top window side relative to the whole screen (in pixels). For the position definition can be used, for example, PmgObject.ScreenY or PmaPanel.ScreenY properties.
bottom - Position of the bottom window side relative to the whole screen (in pixels). Don't set if top is specified. If top and bottom is not specified, then the window will be centered vertically.
z-order - value topmost means that the window will be on top of all Windows windows.
button-cancel - Appearance of the Cancel button. The no value means that the button will not be seen.
vItemValue[for read and write] (Variant) variable (or array of variables) for entering the value
vItemName(Variant) Description (or array of descriptions) to the vItemValue variable
vItemType(Variant) text (or array of texts) identifying the type of the entered value:
"string" - Text is entered (String data type). The graphic form for entering is the EditBox.
vItemAttr1 (Integer type) specifies the maximum number of visible characters (i.e. it affects the width of the EditBox). The maximum length of the entered text is 1000 characters. If the number of visible characters is less than the number of entered characters, then it is possible to scroll in the input box by the cursor.
vItemAttr2 is not used - don't set it or set it to: null for JavaScript or Empty for VBScript.
"int" - An integer (Long data type) is entered. The graphic form for entering is the EditBox.
vItemAttr1 (Long data type) specifies the lower limit of the entered value (if it hasn't to be checked then don't set it or set it to: null for JavaScript or Empty for VBScript).
vItemAttr2 (Long data type) specifies the upper limit of the entered value (if it hasn't to be checked then don't set it or set it to: null for JavaScript or Empty for VBScript).
"real" - The real number (Double data type) is entered. The graphic form for entering is the EditBox.
vItemAttr1 (Double data type) specifies the lower limit of the entered value (if it hasn't to be checked then don't set it or set it to: null for JavaScript or Empty for VBScript).
vItemAttr2 (Double data type) specifies the upper limit of the entered value (if it hasn't to be checked then don't set it or set it to: null for JavaScript or Empty for VBScript).
"bool" - true or false value (Boolean data type) is entered. The graphic form for entering is the CheckBox.
vItemAttr1 and vItemAttr2 is not used - don't set it or set it to: null for JavaScript or Empty for VBScript.
"enum" - The selection from several defined options. Non-negative integer (Long data type) is entered. It represents the index (zero-based index) of the selection from several options. The graphic form for entering is the ComboBox.
vItemAttr1 (Integer type) specifies the maximum number of visible characters (i.e. it specifies the width of the ComboBox).
vItemAttr2 (String type) specifies options. It is the text of words separated by the | character (i.e. pipe sign), for example "option1|option2".

The value in the vItemValue (of the Long type) specifies a word at the beginning that will be pre-selected. There is the index of the selected word at the end.
"password" - Text (String data type) is entered as a password. The graphic form for entering is the EditBox and instead of entering characters only stars * can be seen.
vItemAttr1 and vItemAttr2 have the same meaning as for the "string" type.
"static" - It doesn't serve for entering. Only static text can be seen that is in the vItemName parameter. There can be and they are active characters "new line" in this text (see vbCrLf constant) and it occurs to line breaking if the text is too wide.
The vItemValue parameter is not used - set it to: null for JavaScript or Empty for VBScript.
vItemAttr1 (String type) specifies the appearance of the static text. If not set, then the text is aligned to the left. If the "center" text is set, then the text is centered.
vItemAttr2 is not used - don't set it or set it to: null for JavaScript or Empty for VBScript.
vItemAttr1[optional] (Variant) The first attribute (or array of attributes) whose meaning changes according to vItemType
vItemAttr2[optional] (Variant) The second attribute (or array of attributes) whose meaning changes according to vItemType
Return value:
true - If the InputBox has been closed by the "OK" button
false - If the InputBox has been closed by the "Cancel" button
Note:
The PmaPanel object can be used for creating more complex input windows opened by the PmaPanel.OpenView method.

This method is not functional in Web panels.
Example1:
Simple usage of the method for entering single value:
VBScriptSelect and copy to clipboard

Dim val
val = 3.14
If Pm.InputBox("Enter value", "", val, "Power", "real", 0, 100) Then
' InputBox has been closed by the "OK" button
Pm.Debug "val=" & val
End If
Example2:
The InputBox can be used (similarly to the Pm.MessageBox) only for displaying the text. But the InputBox is more common and for example coordinates of the window location can be entered:
VBScriptSelect and copy to clipboard

Dim sText
sText = "Error in starting the security mode" & vbCrLf & "Temperature out of the permitted range"
Pm.InputBox "Critical error", "button-cancel:no;left:300;top:300;", Empty, sText, "static", "center"
Example3:
Entering one real variable in the range <40, 80> into the PmaNumber object named "Number". The InputBox is called in the event of the Pmg object (i.e. the pMe parameter is the Pmg object) and it will be located on the left from this object:
VBScriptSelect and copy to clipboard

Dim oNumber, val, sStyle
Set oNumber = pMe.Pm("/Number")
val = oNumber.Value
sStyle = "right:" & pMe.ScreenX & ";top:" & pMe.ScreenY & ";"
If Pm.InputBox("Enter value", sStyle, val, "Power", "real", 40, 80) Then
' InputBox has been closed by the "OK" button
oNumber.Value = val
End If
Example4:
Entering multiple values, the window appears "Always on top" and in the midst of the screen:
VBScriptSelect and copy to clipboard

Dim arrValue, arrName, arrStyle, arrAttr1, arrAttr2, ret
arrValue = Array("Sorting", true, 2, 0.4, Empty, 1)
arrName = Array("Name of the process", "Enabled", "number of repetitions", "Percentage of success rate", "", "Regime selection")
arrStyle = Array("string", "bool", "int", "real", "static", "enum")
arrAttr1 = Array(20, Empty, 0, 0, Empty, 20)
arrAttr2 = Array(Empty, Empty, 10, 1, Empty, "Batch|Continuous|Discrete")
ret = Pm.InputBox("Input data", "z-order:topmost;", arrValue, arrName, arrStyle, arrAttr1, arrAttr2)

If ret Then
' InputBox has been closed by the "OK" button
Pm.Debug "Name of the process:" & arrValue(0)
Pm.Debug "Enabled:" & arrValue(1)
Pm.Debug "number of repetitions:" & arrValue(2)
Pm.Debug "Percentage of success rate:" & arrValue(3)
Pm.Debug "Regime selection:" & arrValue(5)
End If
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- InputBox
 
 
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r.o.