Selection list

Selection lists are lists in which the selected options are highlighted in color. Unlike radio boxes or check boxes the whole list need not always be displayed, as you the user can scroll up or down the list within a fixed surround using the mouse. Selection lists are provided to enable selection from several pre-defined alternatives.

To start a script of the event DoubleClick using the keyboard, select an item using the keyboard - and apply using ENTER.

Figure 1. Selection list

To create a selection list

  1. Click on the selection-list tool .

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

  3. Open the Property Sheet

  4. Enter the object name beside (Name).

  5. Enter the options using the List Editor. It is opened using the ... button (Editor) of the property sheet.

Figure 2. List editor

Clicking on the Add After button places the new option after the option selected in the editor. Clicking on the Add Before button places the new option in front of the option selected in the editor. An option can be renamed by clicking on the Rename button. Clicking on the Remove button deletes the selected option.

If you made the list too wide or too narrow for the options, you can change the width of the list afterwards: select the list and then drag the boundary marking with the mouse.

A double-click on the list in the panel during engineering opens the List Editor.

  1. The text formatting for the options can be edited in the Property Sheet. The hotkeys for keyboard selection can be set in the property sheet. Furthermore it is possible to set alternating row colors using the attribute "Alternating Row Colors". In CTRL you can append items using "appendItem" , delete an item using "deletePos". All items can be deleted using "deleteAllItems" etc. (see Control/Control Grafik/Selection list functions.)

  2. To define how the list should react to selection, use the entry "selectionMode" in the property editor.

Figure 3. property editor - selectionMode
  • SingleSelection

    When you select an item, any already selected item turns deselected.

  • MultiSelection

    You can select several items without deselecting the previous selected item. Multiple items can be selected by dragging the cursor with the pressed left mouse button over them.

  • ExtendedSelection

    When you select an item in the usual way, the previous selection will be canceled. However, if you press ctrl when clicking on an item, you can select or deselect multiple items. If you press the shift key while clicking on an item, all items between the previous selected item and the clicked item get selected or unselected, depending on their state. Furthermore, you can select multiple items by dragging the cursor with the pressed left mouse button over them.

  • ContiguousSelection

    When you select an item in the usual way, the previous selection will be cleared. If you press ctrl or shift, you will select all items between the previous selected and the clicked item. Furthermore, you can select multiple items by dragging the cursor with the pressed left mouse.

  • NoSelection

    No selection is possible.

Example

A script that displays errors of two valves is shown below. The most recent message, and thus the message last added to the list, should appear right at the top of the selection list. The function dpConnect() calls the switching() function whenever the online values of the data point variables "VD01.OnOff" or "VD02.OnOff" change. The function ranks the list options according to the received online values and according to the message time. In this example the online value 5 means an error.

main()
{
  string value = ".OnOff:_online.._value";
  dpConnect("switching", "VD01"+value, "VD02"+value);
}
switching(string dp, int w1, int w2)
{
  int hr = hour(t);
  int min = minute(t);
  int sec = second(t);
  string s;
  if((w1 == 5) && (w2 != 5))
  {
    sprintf(s, "Valve D01 blocked! Message time:%d, %d,
    %d",hr,min,sec);
    setValue("","appendItem", s);
  }
  else if((w1 != 5) && (w2 == 5))
  {
    sprintf(s,"Valve D02 blocked! Message
    time:%d,%d,%d",hr,min,sec);
    setValue("", "appendItem", s);
  }
  else if((w1 == 5) && (w2 == 5))
  {
    sprintf(s,"Valve D01&D02 blocked! Message time:%d,%d,%d",
    hr, min, sec);
    setValue("", "appendItem", s);
  }
  else
  setValue("","deleteAllItems");
  setValue("","topPos", 0);
}