On Jan 7, 10:28 am, rajasekhar <[email protected]> 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
([email protected])
FreeMED Software Foundation, Inc
http://freemedsoftware.org/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to