Dave,

I am sorry to say this, but it seems like our issues differ a bit.  In
my case I was removing from the page a panel which contained some
RadioButtons.  Later on I was setting their values, and then putting
the panel that contained them back into the page.  The problem I was
encountering was with radio buttons that were grouped together.  If
one button in the group was selected and I tried to set a different
one in the same group, then they would both be selected, which was not
supposed to happen.  I found that if I put the panel back into the
page first, and then set the values, the groups of radio buttons
worked as they should.

I was trying to recreate what you are talking about wrote the
following code:

  public void onModuleLoad()
  {
    RadioButton radio1 = new RadioButton("group", "option 1");

    radio1.setValue(true);

    VerticalPanel panel = new VerticalPanel();
    panel.add(radio1);

    RootPanel.get().add(panel);
  }

This worked as expected. The radio button was set.  Is this an
accurate representation of your problem?

- Jim

On Feb 19, 10:01 am, dhoffer <[email protected]> wrote:
> Jim,
>
> So how do you know when theradiobuttonis attached to the document?
>
> -Dave
>
> On Feb 19, 3:19 am, CodeMonkey <[email protected]> wrote:
>
>
>
> > Dave,
>
> > Just today I was encountering almost the exact same problem.  I found
> > out that I was having a problem because I was setting the value before
> > I had attached theradiobuttonto the document.  Some ancestor widget
> > had not been added to a widget that was in the document.  Once I
> > changed to code to have the widgets inserted into the page before
> > setting the value everything worked fine.
>
> > I hope this helps!
>
> > - Jim
>
> > On Feb 18, 5:18 pm, dhoffer <[email protected]> wrote:
>
> > > Also doesn't work with 2.0.2.  Created defect 
> > > issuehttp://code.google.com/p/google-web-toolkit/issues/detail?id=4647
>
> > > -Dave
>
> > > On Feb 18, 11:18 am, dhoffer <[email protected]> wrote:
>
> > > > If I add a coupleradiobuttons to the main panel it works fine.
>
> > > > In my app theradiobuttons are in a FlexTable.  I just add them as
> > > > widgets to the table.  Is this a known problem?  Do I have to do
> > > > something different when in a table?
>
> > > > -Dave
>
> > > > On Feb 18, 9:23 am, dhoffer <[email protected]> wrote:
>
> > > > > Hi John,
>
> > > > > Thanks for the reply.  No I'm not doing any RPC with respect to these
> > > > >radiobuttons.  I have RPC but its for other purposes.  I have stepped
> > > > > through the code many times with an IDE, everything seems in order.
> > > > > Its just theradiobuttons are not selected when the app starts?!?  I
> > > > > will try a smaller app and see if they work there.  Its a bit strange
> > > > > <= 10% of the time they are displayed correctly....
>
> > > > > I just noticed that there is a new version 2.0.2...I might try that
> > > > > too.
>
> > > > > -Dave
>
> > > > > On Feb 18, 8:52 am, John Denley <[email protected]> wrote:
>
> > > > > > Its hard to try to solve this problem without being able to debug 
> > > > > > the code,
> > > > > > and Ive certainly got no time for that!
>
> > > > > > You can try to create a really small application that just creates 
> > > > > > and sets
> > > > > > theradiobuttons, so that you can proove to yourself that the 
> > > > > > functionality
> > > > > > works.
>
> > > > > > You could also try stepping through the code line by line (if you 
> > > > > > are using
> > > > > > something like the eclipse IDE)
>
> > > > > > Otherwise you could try manually stepping through your own code, 
> > > > > > very
> > > > > > tedious and boring and you need to concentrate but its possible to 
> > > > > > do if
> > > > > > theres not too much code to trawl through!
>
> > > > > > Regarding the Asynchronos problem, this all depends if you are 
> > > > > > using RPC
> > > > > > calls to your server to get the values for yourradiobuttons, but Im
> > > > > > guessing from what you have said that you are currently hardcoding 
> > > > > > the
> > > > > > initial values (which of course it one of the debugging steps you 
> > > > > > could have
> > > > > > tried). The problem though can be that you create and display 
> > > > > > theradio
> > > > > > buttons, but then the RPC call fails to update them for whatever 
> > > > > > reason, or
> > > > > > worse yet, tries to update theradiobuttons before they have even 
> > > > > > been
> > > > > > created!
>
> > > > > > Other than that I dont know enough about how you are trying to do 
> > > > > > it (or
> > > > > > enough of the internal workings of GWT) to offer any advice on the 
> > > > > > actual
> > > > > > order of creation etc.
>
> > > > > > However its worth remembering and considering whether or not your 
> > > > > > panels or
> > > > > > buttons are being destroyed or just merely hidden. Ive made that 
> > > > > > mistake
> > > > > > with dialog boxes and not realising that a a call to dialogbox.hide 
> > > > > > is only
> > > > > > hiding the dialog box, so if you try to create the dialogbox at the
> > > > > > beginning of a function and then hide it later in the same 
> > > > > > function, later
> > > > > > when you call the same function, it will create a new (clean) 
> > > > > > version of the
> > > > > > same dialogbox....
>
> > > > > > On 18 February 2010 15:17, dhoffer <[email protected]> wrote:
>
> > > > > > > John,
>
> > > > > > > So how do I solve this?  I'm not clear on the solution you 
> > > > > > > propose.
>
> > > > > > > -Dave
>
> > > > > > > On Feb 18, 7:51 am, John Denley <[email protected]> 
> > > > > > > wrote:
> > > > > > > > is it possible that this maybe an asynchronos issue, I have had 
> > > > > > > > that
> > > > > > > before
> > > > > > > > where Im displaying theradiobuttons before im setting them 
> > > > > > > > because the
> > > > > > > > setting of the buttons is based on a reply from the server, 
> > > > > > > > which is an
> > > > > > > > asynchronous call!
>
> > > > > > > > On 18 February 2010 14:28, Bonor <[email protected]> wrote:
>
> > > > > > > > > It should! May be something else deselects it?
>
> > > > > > > > > I use manyradio'sand I just use:
> > > > > > > > >radio[i].setValue(true);
>
> > > > > > > > > On 18 feb, 04:42, dhoffer <[email protected]> wrote:
> > > > > > > > > > gwt 2.0.  I've tried callingsetValue(true, true) 
> > > > > > > > > > onradiobuttons
> > > > > > > but
> > > > > > > > > > when the app is run, neitherradiobuttonis selected, what is 
> > > > > > > > > > the
> > > > > > > > > > trick to code setting the initial value ofradiobuttons?
>
> > > > > > > > > > -Dave
>
> > > > > > > > > --
> > > > > > > > > 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]<google-web-toolkit%2Bunsubs
> > > > > > > > >  [email protected]>
> > > > > > > <google-web-toolkit%[email protected]<google-web-toolkit%252Bu
> > > > > > >  [email protected]>
>
> > > > > > > > > .
> > > > > > > > > For more options, visit this group at
> > > > > > > > >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> > > > > > > --
> > > > > > > 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]<google-web-toolkit%2Bunsubs
> > > > > > >  [email protected]>
> > > > > > > .
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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