List-Box
This function block controls a list box in an HMI, which allows the user to select one of the contained elements.
The input bShow is used to show or hide the HMI object. It is enabled with a HIGH signal on the input bEnable and disabled with a LOW signal. The inputs bSelTrig and iSelIdx are used to select a list element. If a HIGH signal is connected with bSelTrig then iSelIdx determines the position of the selected element. A LOW-HIGH edge at the inputs bUp and bDown scrolls the list page by page up and down. A HIGH signal is written to the outputs bUpEnab or bDwEnab when it is possible to scroll in the corresponding direction.
The inputs iBIPVec, iBINVec, iTIdVec, sTxtVec and sDatVec are used to create new or change the existing list elements. The first element of each vector that is connected with one of these inputs configures a feature of the first list element. And the second elements of the vectors define the second list element and so on. The bitmaps for not selected list elements are set at input iBINVec. And the vector that is connected with iBIPVec defines the bitmaps of the selected elements. The labels are specified at the inputs iTIdVec (text resources) or sText (plain text). And the vector at sDatVec contains the data text for the list elements. If a HIGH signal is written to bTrig then the settings in the vectors are assigned. The existing list elements will be changed or new ones will be added. All the vectors have to contain the same number of elements! Resource texts prevail over plain texts and combinations of data and plain texts, i.e. if a resource ID different to “not defined” is assigned then the corresponding resource text is displayed. The language of the bitmap and text resources is set at input iLang.
The input lBGClr is used to define the background color of the object. The inputs lPBgC and lPTC are used to set the background and text color for the selected element and lNPBgC and lNPTC for the not selected elements. The colors are specified at 8-bit color depth as palettes indices (0-255) and as 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 index of the selected element is written to iPosX. If no element is selected then -1 is output. The outputs sDatVal and sTxtVal are used to provide the data of the selected element. The length of the output is limited to 17 characters.
The output bEdge will set to HIGH for one cycle if an element is selected.
HMI object
The HMI object displays a vertical list with single element selection. Two bitmaps for the states “selected” and “not selected” as well as a text can be assigned to every list element.
If a font with anti-aliasing is used, in addition to the foreground color, several gradations up to the background color are used to smooth out edges during text output. If the resulting glimmering of the background color interferes when a text is displayed over a bitmap, it is recommended to change the background color or to choose a font without anti-aliasing.
Parameter
The mask designer is called as the parameter dialog via the context menu of the block. An HMI object of the type "List Box (Unicode)" 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 …". The tabs in the upper left corner are used to switch between the two views of the dialog.
The global settings for the HMI Object and the list elements are entered in the view “General”. The frame and the background color of the list box as well as the default value for the language and the font for the text outputs belong to them. Different background colors can be assigned to selected and not selected list elements. Not only selections but also an enabled or disabled list box can be highlighted with the text color. The default values for the alignment of the bitmaps and texts as well as for the display of data and plain texts are used to uniformly configure all predefined elements. These settings will also be used when further elements are added to the list via the function block. The height of the elements is specified in pixels. After activating the option “Adjust the object height” the list box is shortened to a multiple of the height of the elements. The other option is used to disable the list box.
The second view contains the predefined elements. The context menu provides commands for the adding of new elements as well as the editing, deleting, selecting and moving of existing ones.
The single elements are defined in their own dialog. The index of the list element is specified after “Item-ID”. The first element gets the index 0. The option “highlighted” is used to select the element. Furthermore, the two bitmaps, a text and a data string can be assigned. The element can be labeled with a resource text, a plain text or a combination of data and plain text. If a resource text is specified then it will be output. The plain text or a combination of data and plain text are only displayed if the resource text is set to “not defined”. The output of the plain text and the data is configured in the “Display” setting. Every list element can get its own alignment and display parameter. The global parameter will be used if “default” is chosen. Then all elements can be uniformly formatted.
Signals
Name | I/O | Type(s) | Function |
---|---|---|---|
sTxtVec | I | TEXT | Plain text vector for labeling the elements |
iTIdVec | I | WORD | Text resource vector (ID) for labeling the elements |
iDatVec | I | WORD | Data vector for the elements |
iBIPVec | I | WORD | Bitmap resource vector (ID) for selected elements |
iBINVec | I | WORD | Bitmap resource vector (ID) for not selected elements |
iSelIdx | I | WORD | Index of the element that is to select |
bSelTrig | I | BIT | Select the entry iSelIdx |
bUp | I | BIT | Scroll upwards |
bDown | I | BIT | Scroll downwards |
bShow | I | BIT | Show/hide list box |
bEnable | I | BIT | Enable/disable list box |
iLang | I | WORD | Language resource (ID) |
bTrig | I | BIT | Set the element definitions |
lBGClr | I | LONG | Background color of the object |
lPBgC | I | LONG | Background color of the selected element |
lPTC | I | LONG | Text color of not selected element |
lNPBgC | I | LONG | Background color of not selected elements |
lNPTC | I | LONG | Text color of not selected element |
iPosIdx | O | WORD | Index of the selected element |
sDatVal | O | TEXT | Data text of the selected element |
sTxtVal | O | TEXT | Text of the selected element |
bEdge | O | BIT | Indicator of a selection |
bUpEnab | O | BIT | State for scroll up |
bDwEnab | O | BIT | State for scroll down |
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.
Visualization
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.
Comments
The index of the elements starts always with 0.