Edit box is a basic text control that enables a user to type a small amount of text.
Edit boxes are commonly used for modifying values of variables and parameters at the model runtime. You can link this control to a variable or a parameter of type String, double or int. In this case when the user changes the content of the edit box, the linked variable/parameter immediately gets this content as its value
However, if your variables or parameters are of type int, we recommend to modify their values using sliders. boolean variables are best controlled using check boxes.
You may have a look at the demo model below. It shows how to link the edit box to a parameter rate of the Source object in a simple process model.
Simple demo model: Edit Box Linked To Parameter Of Flowchart Block
To add an edit box
Name – The name of the edit box. It is used to identify and access the control from code.
Ignore – If selected, the edit box will be excluded from the model.
Visible on upper agent – If selected, the control will be also visible on the upper agent where this agent lives.
Link to – If you want to bind the edit box with a variable or a parameter of type String, double or int (on changing the value of the edit box, the linked parameter/variable immediately gets this value), select this checkbox and enter the name of the variable/parameter that you want to link to the edit box.
Minimum value – [Enabled if the Link to checkbox is selected and the type of the linked variable/parameter is int or double] The minimum value that can be entered in the edit box (the lower bound of the values range).Maximum value – [Enabled if the Link to checkbox is selected and the type of the linked variable/parameter is int or double] The maximum value that can be entered in the edit box (the upper bound of the values range).
Default value – [Visible if the Link to checkbox is not selected] The expression of type String that defines the default content of the edit box.
Enabled – Here you can specify Boolean expression determining whether the edit box is enabled or disabled.
Here you can type the code to execute when the content of the edit box is modified. The current text of the edit box is available here as value (local variable of String type).
Text color
– The control specifies the color of the text displayed inside the edit box. Click inside the control and choose a color from the set of the most used ones, or choose a custom color using the
Colors dialog box.
Font – Specifies the font family for the text displayed inside the edit box. In the field to the right (pt.) you can adjust the size of the text.
Italic – If checked, the text displayed inside the edit box will be italicized.
Bold – If checked, the text displayed inside the edit box will be emphasized in bold.
Level – Level to which this control belongs.
X – X-coordinate of the control's upper left corner.
Y – Y-coordinate of the control's upper left corner.
Width – The width of the control (in pixels).
Height
– The height of the control (in pixels).
Visible – The control's visibility. The control is visible when the specified expression evaluates to true, otherwise it is not visible.
Replication – Here you specify the number of copies of this control you want to be created. If you leave this field empty, only one such control will be created.
Show name – If selected, the name of the control will be displayed on a presentation diagram.
Icon
– If selected, the edit box will be considered as a part of the
agent's icon.
Function |
Description |
double getDoubleValue() |
Returns the current double value of the edit box. Function throws an exception when the value isn't a number. |
int getIntValue() |
Returns the current
int
value of the edit box. |
String getText() |
Returns the text of the edit box. |
Function |
Description |
void setText |
Sets the text of the edit box. Doesn't execute user action code. If value-type is numeric and the given text isn't a valid number, nothing will be changed, and if text is a number but not within [min, max], it will be corrected to min or max.
Parameter: |
void setText |
Sets the text of the edit box. Executes user action code (if there is any) if callAction parameter is true. If value-type is numeric and the given text isn't a valid number, nothing will be changed, and if text is a number but not within [min, max], it will be corrected to min or max. |
void setText |
Sets the numeric value of the edit box with value type ShapeControl.TYPE_DOUBLE or ShapeControl.TYPE_INT. Doesn't execute user action code. |
void setText |
Sets the numeric value of the edit box with value type ShapeControl.TYPE_DOUBLE or ShapeControl.TYPE_INT. Executes user action code (if there is any) if callAction parameter is true.
Parameters: |
void setValueToDefault() |
Sets the text of the edit box to what was provided as the default one. Doesn't execute user action code |
Function |
Description |
double getMin() |
Returns the minimum value of the edit box. |
double getMax() |
Returns the maximum value of the edit box. |
void setRange (double min, double max) |
Sets the minimum and the maximum values of the edit box with numeric value-type: ShapeControl.TYPE_DOUBLE, ShapeControl.TYPE_INT. Doesn't execute user action code If the edit box is configured to work with int values, the given [min, max] range may be automatically corrected to have integer bounds (within the given double bounds) This function does nothing if the edit box already has such range.
Parameters: |
void setRange(double min, double max,
|
Sets the minimum and maximum values of the edit box with numeric value-type: ShapeControl.TYPE_DOUBLE, ShapeControl.TYPE_INT. If the current edit box value changes, it executes user action code (if there is any) in the same thread - if callAction parameter is true. If edit box is configured to work with int values (see ShapeControl.TYPE_INT), the given [min, max] range may be automatically corrected to have integer bounds (within the given double bounds) This function does nothing if the edit box already has such range
Parameters: |
Function |
Description |
boolean isEnabled() |
Tests if the control is enabled or disabled. Returns true if enabled, otherwise false. |
void setEnabled |
Sets the control enabled or disabled.
Parameter: |
Function |
Description |
void action() |
Executes the action associated with the edit box. |
Function |
Description |
double getX() |
Returns the X coordinate of the control (namely, the X coordinate of its upper left corner). |
double getY() |
Returns the Y coordinate of the control (namely, the Y coordinate of its upper left corner). |
void setX(double x) |
Sets the X coordinate of the control.
|
void setY(double y) |
Sets the Y coordinate of the control.
|
void setPos(double x,
|
Sets new coordinates for the control.
Parameters: |
Function |
Description |
void setBackgroundColor |
Sets the background color of this edit box.
|
void setTextColor |
Sets the text color of this edit box. Parameter: |
Function |
Description |
boolean isVisible() |
Returns the visibility of the control. |
void setVisible(boolean v) |
Sets the visibility of the control.
Parameter: |