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.
package client;
import org.eclipse.edt.rui.widgets.Box;
import org.eclipse.edt.rui.widgets.Combo;
import org.eclipse.edt.rui.widgets.TextField;
import eglx.ui.rui.Event;
Handler MyHandler 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 fields and functions are described in the following topics in the EGL Programmer’s Guide: “Rich UI widget fields” and ”Rich UI widget functions.”
import org.eclipse.edt.rui.widgets.Combo;