<< Click to Display Table of Contents >>
XC_Command |
To change a pump's properties, let's create an XControl to use as an indexed Screen.
1.Insert an XControl called "XC_Command".
2.Configure it according to the next figure. It uses three Texts ("Name", "Command", and "Speed"), a Toggle Button object ("ON" and "OFF"), and a Command Button ("Speed").
XC_Command XControl
3.Create the Source Property to access the Properties of the XObject XO_Pump.
Source Property
4.In the Name Text, create a Simple Link from the Value property to the DocString property of the object XO_Pump.
Simple Link with the DocString property
5.In the Toggle Button, create a Bidirectional Link from the Value property to the Status Property of the XObject XO_Pump to change a pump's status. In the Caption property, create a Digital Link to change the text on the Command Button depending on the value of the Status Property.
Links between Value and Caption properties
6.In the Command Button, let's change the pump's rotation speed value. To do so, let's use Viewer's SelectMenu method on Command Button's Click event and pass the returned value to the Speed Property.
NOTE |
As the return of the SelectMenu method starts at 1 (one) and not at 0 (zero) like the value of the Speed Property (0: Low, 1: Medium, and 2: High), let's subtract 1 (one) from the op variable in the script. |
op = Application.SelectMenu("Low|Medium|High")
XC_Command.Source.Speed = op - 1
7.In Toggle Button's Caption property, create a Table Link to change the text of the Command Button according to the value of the Speed Property.
Link between Caption and Speed properties
8.To disable a change in speed if the pump is turned off, create a Simple Link from the Enabled property to the Status Property.
Link between Enabled and Status properties
9.Save these changes and register the library.