Rich UI Combo

A Rich UI combo widget defines a combo box, which presents one of several selectable options and lets the user temporarily open a dropdown list to select a different option.

Here is example code:
import com.ibm.egl.rui.widgets.Box;
import com.ibm.egl.rui.widgets.Combo;
import com.ibm.egl.rui.widgets.TextField;
import egl.ui.rui.Event;

Handler ListExample Type RUIHandler 
   { initialUI = [myBox] }

   myBox Box{columns=2, children= [myCombo, myTextField]};

   myCombo Combo
   {
      values = ["one", "two", "three", "four"],
      selection = 2, onChange ::= changeFunction
   };

   myTextField TextField
      {text = myCombo.values[myCombo.selection]};

   Function changeFunction(e Event IN)
      myTextField.text = myCombo.values[myCombo.selection];
   end
end 
The following properties are supported:
  • values, which holds an array of strings that each represent a selectable option.
  • selection, which is integer that represents the position of the string in the array. If you set the value of selection before displaying the combo box, the specified string is displayed initially; otherwise, the first string is displayed initially.

    The first string in the array is at position 1, not 0.

The following functions are for general use:
  • getValues, which takes no parameters and returns an array of strings that each represent a selectable option.
  • setValues, which takes an array of strings that each represent a selectable option. The function does not return a value.

The functions getSelection and setSelection are available; but in most cases, retrieve a value or assign a value to the selection property rather than invoking a function.

Other supported properties and functions are described in “Widget properties and functions.”

Use of this widget requires the following statement:
import com.ibm.egl.rui.widgets.Combo;