I basically just need to extract the text that is associated with the
'radioButtonText' field when an item is selected. (I will then send
this value back to the server, to be used as part of an SQL
statement).

Can you give an example of how to use a subclass RadioButton? I have
never used subclasses before so wouldnt know where to start.

Regards,
Jack

On Dec 28, 4:46 pm, "Ian Bambury" <[email protected]> wrote:
> RadioButtons are a pain like that.
> Obviously I don't really know what you are doing with this, but one option
> would be to subclass RadioButton. You can then have it listen to itself, and
> fill a static field with the last selected text, or have a static field
> which contains the currently selected instance.
>
> Ian
>
> http://examples.roughian.com
>
> 2008/12/28 [email protected] <[email protected]>
>
>
>
> > Thanks for your reply. I now have the click listener working for the
> > Radio Buttons. However, I now have a new problem. I need to get the
> > text associated with the Radio Button and put into a String. So at the
> > moment I have:
>
> > ClickListener listener = new ClickListener()
> >    {
> >        public void onClick(Widget sender)
> >        {
> >            changedRadioValue = radioButtonText;
> >            System.out.println("RADIO: "+ changedRadioValue);
> >         }
> >    };
>
> > for (int i = 0; i<data.itemNameArrayList.size();i++){
>
> >  nameList.addItem(data.itemNameArrayList.get(i).toString());
> >                                 radioButtonText =
> > data.itemNameArrayList.get(i).toString();
> >                                 RadioButton rb = new RadioButton("group",
> > radioButtonText);
> >                                rb.addClickListener(listener);
> >                                editItemsRadioPanel.add(rb);
>
> >                        }
>
> > At the moment, it prints out the value of the last Radio Button
> > whenever a button is clicked. How do I get it to select the value that
> > is selected?
>
> > Regards.
> > Jack
>
> > On Dec 28, 3:34 pm, "Ian Bambury" <[email protected]> wrote:
> > > You can't do everything in one statement (well, actually you can, but it
> > > gets unreadable and unless you are a C programmer, you won't want to do
> > it
> > > like that)
>
> > > RadioButton  rb = new RadioButton("group", radioButtonText);
> > > rb.addClickListener(listener);
> > > editItemsRadioPanel.add(rb);
>
> > > Ian
>
> > >http://examples.roughian.com
>
> > > 2008/12/28 [email protected] <[email protected]>
>
> > > > Hi,
>
> > > > Cheers for your reply. The example does not say how to use it for
> > > > Radio Buttons. I can not get my head round how to implement a click
> > > > listener for a Radio button. You can only have 2 parameters for a
> > > > radio button, and I am already using 2. The examples seem to add a
> > > > click listener as a 'second' parameter. How can I add a click listener
> > > > if I already have 2 parameters?
>
> > > > Regards,
> > > > Jack
>
> > > > On Dec 28, 2:07 pm, "Ian Bambury" <[email protected]> wrote:
> > > > > I think you just need a clicklistener don't you? And then check the
> > state
> > > > of
> > > > > the radiobutton.
> > > > > Same thing ashttp://examples.roughian.com/#Widgets~CheckBox
> > > > > or have a look athttp://
> > examples.roughian.com/#Listeners~ClickListener
>
> > > > > Ian
--~--~---------~--~----~------------~-------~--~----~
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