This function block controls a button or switch in an HMI, which can be assigned a text as well as state-dependent colors and bitmaps.
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 iENBmp, iEPBmp, iDNBmp and iDPBmp are used to assign background bitmaps for the button states “normal”, “pressed”, “disabled” and “disabled + pressed”. A label is assigned via the inputs iText or sText. With iText a language specific text resource is selected. The plain text that is connected to sText is displayed if iText is not connected or the parameter value “undefined” is assigned to it. The language of the used bitmap and text resources is specified at input iLang.
Depending on the type selection in the parameter dialog the pressing of the button or the state of the switch is written to the output bPress. If the type is “Button (signal on button down)” or “Button (signal on button up)” then the output bPress changes for one program cycle from LOW to HIGH after the button is pressed. If the object is a switch then HIGH is output in the states “pressed” and “disabled + pressed”. In the other states LOW is written to bPress.
The HMI object displays a button or a switch. It can be labeled with a text and state dependent bitmaps.
If the alignment is set to „Bitmap and Text centered” then large pictures can conceal the edges of the button. Other shapes can be easily assigned with the help of this feature, e.g. flat buttons or check boxes.
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 the text is displayed over the bitmap, it is recommended to change the background color or to choose a font without anti-aliasing.
The mask designer is called as the parameter dialog via the context menu of the block. An HMI object of the type "Bitmap Button / Switch" 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 …". Here, the type selection determines whether the object is a button or a switch. A button is only pressed as long as the mouse button is pressed. The button returns to normal state when the mouse button is released. A switch persists after the first pressing in the state “pressed” and changes only after another use back to normal state. Furthermore, two button types are distinguished. One writes an edge to the output of the function block when the button is pressed and the other when it is released.
The state dependent background and text colors, the font as well as the default values for the bitmaps and the texts and their alignment are configured in the dialog. A language specific text resource or a plain text can be assigned to label the button.
|sText||I||TEXT, DYNTEXT||Plain text|
|iText||I||WORD||Text resource (ID)|
|iEPBmp||I||WORD||Bitmap resource (ID) – pressed|
|iENBmp||I||WORD||Bitmap resource (ID) – normal|
|iDPBmp||I||WORD||Bitmap resource (ID) – disabled + pressed|
|iDNBmp||I||WORD||Bitmap resource (ID) – disabled|
|iLang||I||WORD||Language resource (ID)|
|bPress||O||BIT||Button pressed or switch state|
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.