this.updateAction = updateAction;
- field = new TField(this, 0, 0, width - 3, false, "",
- updateAction, null);
+ field = addField(0, 0, width - 3, false, "", updateAction, null);
if (valuesIndex >= 0) {
field.setText(values.get(valuesIndex));
}
- list = new TList(this, values, 0, 1, width, valuesHeight,
+ list = addList(values, 0, 1, width, valuesHeight,
new TAction() {
public void DO() {
field.setText(list.getSelected());
* @param text the new text in the edit field
*/
public void setText(final String text) {
+ setText(text, true);
+ }
+
+ /**
+ * Set combobox text value.
+ *
+ * @param text the new text in the edit field
+ * @param caseSensitive if true, perform a case-sensitive search for the
+ * list item
+ */
+ public void setText(final String text, final boolean caseSensitive) {
field.setText(text);
for (int i = 0; i < list.getMaxSelectedIndex(); i++) {
- if (list.getSelected().equals(text)) {
- list.setSelectedIndex(i);
- return;
+ if (caseSensitive == true) {
+ if (list.getListItem(i).equals(text)) {
+ list.setSelectedIndex(i);
+ return;
+ }
+ } else {
+ if (list.getListItem(i).toLowerCase().equals(text.toLowerCase())) {
+ list.setSelectedIndex(i);
+ return;
+ }
}
}
list.setSelectedIndex(-1);