List-Box

This function block is used to refer to a list box in a HMI, which allows the user to select an element form the listed content.

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, 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, 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 index of the selected element is written to iPosX. If no element is selected, -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 a single element selection. Two bitmaps for the states “selected” and “not selected” as well as a text can be assigned to every list element.

Parameters

In the parameter dialog a HMI object of the type “List Box (unicode)” is assigned to the function block.

Using the context menu of the function block, the mask designer can be invoked as the parameter dialog. The mask designer is used to create the assignment to the HMI object. Now the preferences of the HMI object can be set with the help of the mask designer.

The parameter dialog of the object consists of two views. The tabs in the upper left corner are used to switch between the views.

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 definition of the single elements happens in its 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, 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 colored highlight in the function block indicates, whether a HMI object is assigned or not.

Comments

The index of the elements always starts with 0.