Hi Jon,

Without seeing more of your code, the problem might be as simple as
the fact that you need to add the radio buttons to some container that
has been added to the window. So either Root.get().add() all your
buttons, or add them all to something like a panel and then add the
panel in the same way. If this is the problem, check out the widget
gallery radiobutton example and click on the source code tab:
http://gwt.google.com/samples/Showcase/Showcase.html#CwRadioButton

If that wasn't the problem, perhaps it's in the way you're
instantiating the radiobuttons? If you have, say, an array of their
labels you've gotten dynamically per question and a container
VerticalPanel:
String[] buttonnames = {"there", "their", "they're"};
VerticalPanel vPanel = new VerticalPanel();

The code should be as simple as
RadioButton[] arby = new RadioButton[buttonnames.length];
for(int i = 0; i < buttonnames.length; i++) {
  arby[i] = new RadioButton(groupName, buttonnames[i]);
  vPanel.add(arby[i]);
}

Then just add vPanel to the window so you can see it.
Root.get().add(vPanel);

Hope this helps and I'm not completely off base interpreting your
problem!

On Oct 23, 6:00 pm, Jon <[email protected]> wrote:
> Hi everyone,
>
> I'm new to GWT and developing a sample app. I want it to display
> simple questions that the user answers by clicking radio buttons. Some
> questions have two radio buttons, some have more. For example, a two
> button question:
>
>   The boy
>      o  go    o  goes
>   to the store
>
> And a three button question:
>
>   They took
>       o there   o their   o they're
>   time answering the question
>
> So, how do I use GWT to vary the number of radio buttons for each
> question?
>
> I had thought the way was to use Java arrays:
>
>         RadioButton arby[] = null;
>         arby[0] = new RadioButton(groupName, "go);
>         arby[1] = new RadioButton(groupName, "goes");
>
> But this doesn't work. Compiles but no radio buttons appear at all.
>
> What is the right way?
>
> Perhaps more generally, what is the way to create objects that refer
> to page elements whose number is known at runtime?
>
> Thanks!
>
> -- Jon
--~--~---------~--~----~------------~-------~--~----~
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