[Gtk-sharp-list] How to create a group for Gtk.RadioToolButton ?

Le Sensei... sensei@quarkup.org
Thu, 14 Apr 2005 13:50:14 +0200


Quoting Thomas Pryds Lauritsen <pryds@duckburg.dk>:

> Anset wrote:
> | There is also a constructor that does not take a button. :)
>
> According to monodoc, there is not such a constructor for
> RadioToolButton, though.

According to this:
http://www.go-mono.com/docs/index.aspx?link=T%3aGtk.RadioToolButton%2f%2a
there are several, but none empty.

> | Button0 = new RadioButton("Label0");;
> | Button1 = new RadioButton(group, "label1");
> | Button2 = new RadioButton(group, "label2");
>
> This doesn't seem to work with RadioToolButton, though. I tried the
> following code:
>
> Toolbar t = new Tollbar();
> RadioToolButton r0 = new RadioToolButton();
> r0.Label = "label 0";
> t.Add(r0);
> RadioToolButton r1 = new RadioToolButton(r0);
> r0.Label = "label 1";
> t.Add(r1);
>
> However, the initialisation of r0 fails since there is no suh
> constructor for RadioToolButton.

You should probably just do this:

Toolbar t = new Tollbar();
RadioToolButton r0 = new RadioToolButton(null); //See previous link
r0.Label = "label 0";
t.Add(r0);
RadioToolButton r1 = new RadioToolButton(r0);
r0.Label = "label 1";
t.Add(r1);

Hope this helps,

--
Alain Perry