Button List

This function block controls a button list in an HMI, where up to 16 buttons are combined into one single object.


The input bShow is used to show or hide the HMI object. The button list can be enabled or disabled by the input bEnab. At the input lInpBNM a value is given which represents a bit mask. This bit mask specifies which buttons of the list are selected. The input bTrigBNM is used to assign that selection to the list.


The background color of the object can be assigned by the input lBGClr. The background and the text color for the selected buttons are set by the inputs lPBgC and lPTC. For the not selected colors the same can be done with the inputs lNPBgC and lNPTC. 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 input iLang is used to select the language for the used text and bitmap resources.
With a change from LOW to HIGH on the input bLftUp the button list can be scrolled to the left or upwards and on the input bRghDwn to the right or downwards. The outputs bLUEnab and bRDEnab indicate by a HIGH signal, that scrolling in that direction is possible.


The currently pressed buttons are provided at the output lBtnNmb as a bit mask. The output bEdge indicates that any button on the list was pressed.

HMI object

The HMI object displays a list of up to 16 buttons in a vertical or horizontal direction. This list can work as a radio button (only one selection is possible) or as a selection list (where multiple selections are possible). If the list of the buttons is larger than the object itself, the list can be scrolled.

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 texts are displayed over bitmaps, 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 "Button List (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 of the dialog are used to switch between the two views.

The global settings for the HMI object and the list elements are entered in the view “General”. The direction of the list (vertical or horizontal) can be selected. It can be set, whether the list can contain a single or multiple selection. The general display style of the list (with or without frame, raised or recessed) can be selected. The default values for the language and the font for text display and the alignment of displayed bitmaps can be defined. The height of the buttons 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. If the list is used in horizontal direction, this applies to the width (instead of height). The other option is used to disable the button list. Furthermore, the default values of the colors for the background and the buttons with their different states can be selected.

The second view contains the predefined buttons. The context menu provides commands for the adding of new buttons as well as the editing, deleting, selecting and moving of existing ones.

The single buttons are defined in their own dialog. The index of the list element is specified by “Button-ID”. The first element gets the index 0. The option “highlighted” is used to select that button. Furthermore, the bitmaps for the different states of the button can be selected. A Plain text or a text resource can be displayed on the button. The alignment of the button and the text can be chosen. The global parameter will be used if “default” is chosen. Then all elements can be uniformly formatted.

Signals

Name I/O Type(s) Function
lInpBNM I LONG Bit mask for the preselection of pressed buttons
lBGClr I LONG Background color of the object
IPBgC I LONG Background color of pressed buttons
IPTC I LONG Text color of pressed buttons
INPBgC I LONG Background color of not pressed buttons
INPTC I LONG Text color of not pressed buttons
bShow I BIT Show/hide the button list
bEnable I BIT Enable/disable the button list
iLang I WORD Language resource (ID)
bTriBNM I BIT Assign the input lInpBNM
bLftUp I BIT Scroll to left/upwards
bRghDwn I BIT Scroll to right/downwards
lBtnNmb O LONG Indicates the pressed buttons as a bit mask
bEdge O BIT Indicates a button is pressed
bLUEnab O BIT State for scroll left/up
bRDEnab O BIT State for scroll right/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.

Example

The following example shows an application to realize a tabulator like functionality with a button list. The list works as a radio button. The button list object is connected to two bitmap button objects to enable scrolling within the list. The output lBtnNmb, which contains the button selection, is connected to a converter function block to transform it into a BIT vector. This vector is broken into its elements by a vector split function block. These values are used to show or hide several defined HMI masks. The buttons left and right to the button list are used to scroll the list to any position to display currently unavailable buttons.

The view in the HMI might look like this: