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.
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 first string in the array is at position 1, not 0.
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.”
import com.ibm.egl.rui.widgets.Combo;