On Jan 7, 10:28 am, rajasekhar <
raja...@gmail.com> wrote:
> How to get the selected list box value.I have to display
> field is username and value is email. when username is selected I need
> to get value as email id . Please help me on this regard.
For widget w, this snippet would work:
w.getValue(w.getSelectedIndex());
I ended up subclassing ListBox to "CustomListBox" with the following
methods for getting and setting widget value:
public String getWidgetValue() {
try {
return getValue(getSelectedIndex());
} catch (Exception e) {
return new String("");
}
}
public void setWidgetValue(String val) {
if (getItemCount() > 0) {
for (int iter = 0; iter < getItemCount(); iter+
+) {
if (getValue(iter).compareTo(val) ==
0) {
this.setItemSelected(iter,
true);
}
}
}
}
... Those should allow you to easily get and set widget values, so
long as you extend ListBox to include them.
--
Thanks,
Jeff
(
je...@freemedsoftware.org)
FreeMED Software Foundation, Inc
http://freemedsoftware.org/