GPI_Button Component

GPI_Button

Description

This script component is intended to aid consistent display of GPI mimics and switches across multiple panels. It provides a mechanism to change the appearance of the display between button format and label format and to decide if the button should support user clicks. The colours of the off and on states are set through a stylesheet to define the basic properties of the display, and statesheets to define the colour scheme for the contact open and contact closed displays. The component also reports GPI state changes to the host panel so that the connections engine can be used for message passing.

The only way to set the device ID and contact number is through the Instance field on the Visual Editor status display. the component reads the contact number and data from the BNCS instances.xml file. The component recognises an extra tag idtext in the instance data for a contact - the text to show on the button. This is one of the features leading to a consistent display across multiple user forms.

The screen grab below shows an example of the button configuration in the BNCS Visual Editor status display.

The parameters that can be set, and their functions are listed below:

1: useButton
This parameter controls the appearance of the control. When the value is set to true (default condition) the control draws as a button using the selected panale manager style. When the value is set to false the control draws as a flat label.

2: sendGPI
This logic flag controls the behaviour when the button or label is clicked. If the parameter is set true the inverse of the current state of the contact is sent to the driver. If the parameter is set false the control does not send data to the driver. This latter behaviour is good when the user just wants a tally disply of the state (eg for an input signal).

3: useText
This logic flag determines which text is shown on the button/label. When the value is set to true text from parameter buttonText is displayed. When the value is set to false the text is taken from field idtext in the instances entry.

4: buttonText
The value of this parameter is the text displayed when useText is set true. The text may include special BNCS text controls such as the new line symbol |.

5: stateSheet
This parameter is the name of the style sheet that defines the basic look of the text (font, size etc).

6: offState
This parameter is the name of the state sheet that defines the look of the button/label when the associated contact is off or open.

7: onState
This parameter is the name of the state sheet that defines the look of the button/label when the associated contact is on or closed.

Commands

Name | Type | Use
useButton | Text: true or false | Control the look of the control
sendGPI | Text: true or false | Enable/disable button clicks to update contact state
useText | Text: true or false | Select text from instances (false) or butttonText parameter (true)
buttonText | String | Text to display if useText is true

Notifications

Name | Use
notification=<GPIvalue> | Reports state of GPI contact on change (0 or 1)

Stylesheets

Name | Use
stateSheet | Basic control font properties
offState | Colours when contact is open
onState | Colours when contact is closed

Developers Notes

Button size is 120 by 60.
Copyright BBC Academy 2017