This function block controls an input line for numeric values in an HMI.
The input bShow is used to show or hide numeric input line. The language of the font and text resources that have been selected in the parameter dialog is set at iLang. If the signal on nTrig changes to HIGH then the input value that is connected to sPref is checked and assigned to the object. The input value is cut at the first invalid character or format error.
The input lBGClr can be used to set the background color and lFGClr to set the text color. Palette indexes (0-255) are expected at 8-bit color depth and BGR-values (blue-green-red) at 24-bit color depth. They are provided e.g. by the color parameter block as of library version 7.0.
The current value of the numeric input line is written to the output sValue. The changing of the current value is signaled with an edge at the output bChg. The changes can be caused by the user as well as by the setting of another value with help of the inputs bTrig and sPref.
The HMI object displays the left aligned current value in an input line. A modal dialog is opened in the center of the display after the input line has been clicked. Depending on the configuration the modal input dialog is simple or complex.
The simple dialog consists of a line, the number of keys, optional keys for the sign and the decimal point and the OK button. After opening the dialog, the line is empty. The handling is similar to a calculator. The sign can be changed at any time. The dialog is moved using the caption. And the contained button is used to cancel the input.
The complex dialog displays the current value after opening. The value can be deleted character by character with the back key. Or it can be removed completely with the clear key. Because of the missing caption, the dialog cannot be moved. An additional key is provided to cancel the input.
The mask designer is called as the parameter dialog via the context menu of the block. An HMI object of the type "Numeric Input" is assigned to the block by creating or selecting it. With the checkbox in the lower left corner you can switch between global and instanceable assignment.
Default settings for the HMI object are made in the corresponding dialog, which appears after "Additional settings …". It is divided in three sections.
Global settings for the input line as well as for the modal dialog are entered in the section “General”. The initial value and the default value for the language can be specified there. The other parameters determine the length and the range of values. They influence the checking of input values. And they affect the visibility of the keys for the sign and decimal point in the dialog.
The frame type, the colors and the font of the HMI Object are configured in the section “Input line”.
The third section contains the settings for the modal dialog. There are entered the type as well as the font for the line and the keys, their colors and the resource texts for the labels. The size of the line and the keys is calculated on the basis of the selected font and the assigned labels. And the dialog is automatically adapted. Furthermore, a timeout can be defined. If the specified time has elapsed after the last pressing of a key or the opening then the input is automatically canceled. And the dialog is closed.
|iLang||I||WORD||Language resource (ID)|
|bTrig||I||BIT||Set sPref to the object|
|bChg||O||BIT||Current value has been changed|
Note: If inputs are not connected the object appears with the corresponding default parameters that have been entered in the mask designer. Otherwise the input signal from the function block overwrites the according setting from the parameter dialog.
The assignment of the HMI object is displayed in the block by the color of the text boxes. A yellowish background indicates a global assignment. If the assignment is instanceable, the background is white. And at missing or incorrect assignment it is red.
The function block operates only with the data type TEXT for the values. To be able to use numeric data types converter function blocks from the adapter library have to be used.