Spin button

Spin buttons are list boxes containing two arrows at the right side. The window only displays one list option. By clicking on one of the arrow heads, the options either before or after the currently visible element will be displayed in the window.

Spin boxes are provided to enable selection of just one option from a sequence of pre-defined alternatives arranged in a logical order. This sequencing is recommended because more than one value cannot be displayed at once. Typically a sequence of numerical values, or measurement scales, are provided for selection. The selected option only will be displayed. Spin buttons can be used for setting data point values or triggering actions. For instance switching on pumps gradually.

There are only numerical spin buttons.

Figure 1. Spin button

Maximum and minimum values and increment size define the values (and their amount of detail) that will be displayed.

To create a spin button:

  1. Click on the spin-button tool .

  2. Click in the panel work area. Define the size.

  3. Open the Property Sheet

  4. Enter the object name (Name) in the name field.

  5. The text formatting for the options can be edited in the Property Sheet.

  6. Enter the maximum and minimum values, the increment and the value that should be shown.

A double-click on the spin button in the panel during engineering opens the Changed script.

Example

An example script is shown below for a spin button with four options (1, 2, 3, 4) which can be used to close four valves (VD01 to VD04). The dpSet() function sets the original value of the data point variables "VD01.OnOff" to "VD04.OnOff" to the value given by the selected spin button option. In this example the original value of one is assigned to the valve status "Close", and the spin button contains the numerical options "1", "2", "3" and "4".

main()
{
  int cnt;
  getValue("", "text",cnt);
  if(cnt == 1)
  {
    dpSet("VD01.OnOff:_original.._value ",1);
  }
  else if(cnt== 2)
  {
    dpSet("VD01.OnOff:_original.._value",1);
    dpSet("VD02.OnOff:_original.._value ",1);
  }
  else if(cnt == 3)
  {
    dpSet("VD01.OnOff:_original.._value ",1);
    dpSet("VD02.OnOff:_original.._value ",1);
    dpSet("VD03.OnOff:_original.._value ",1);
  }
  else if(cnt== 4)
  {
    dpSet("VD01.OnOff:_original.._value",1);
    dpSet("VD02.OnOff:_original.._value ",1);
    dpSet("VD03.OnOff:_original.._value ",1);
    dpSet("VD04.OnOff:_original.._value ",1);
  }
}                        

For spin button functions see Control Graphics/Spin button functions.