Not a bad idea, but probably would make this just a grouping object vs a widget, since there are myriad ways you might want to lay these out and you don't want to have to deal with this in RadioButtonGroup. So code more like:
FormPanel fp = new FormPanel(); RadioButtonGroup rbg = new RadioButtonGroup(); fp.add(new RadioButton(rbg, "button1")); fp.add(new RadioButton(rbg, "button2")); Of course this is also fairly simple to implement in your own application. On Apr 16, 12:49 am, markovuksanovic <[email protected]> wrote: > I think it would be nice to have a RadioButtonGroup object which would > hold RadioButtons belonging to the same group. It would also implement > a getSelected methold which would return currently selected > RadioButton. > > An example of the code would be sth like. > > FormPanel fp = new FormPanel(); > RadioButtonGroup rbg = new RadioButtonGroup(); > > RadioButton rb1 = new RadioButton("group1", "button1"); > RadioButton rb1 = new RadioButton("group2", "button2"); > RadioButton rb1 = new RadioButton("group3", "button3"); > > rbg.add(rb1, rb2, rb3); > fp.add(rbg); > > Window.alert(rbg.getSelected().getText()) > > or using UiBinder sth like: > <g:FromPanel> > <g:RadioButtonGroup> > <g:RadioButton name="group1" text="button1"></g:RadioButton> > <g:RadioButton name="group1" text="button2"></g:RadioButton> > <g:RadioButton name="group1" text="button3"></g:RadioButton> > </g:RadioButtonGroup> > </g:FormPanel> > > Comments? -- 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.
