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

Anset Anset@anset.org
Thu, 14 Apr 2005 13:35:02 +0200


Oeps,

Sorry for misreading your question. I have not played with those yet.

In monodoc I find the followin ctor:

	RadioToolButton(GLib.SList)
	Constructor with support for button groups.

And then:

	RadioToolButton(RadioToolButton)
	Create a new button in the same group as another.

So you would first create a button with the first ctor, then use that
Button as an argument in all the following buttons.


The SList argument of the first ctor is not a problem since, according
to monodoc;

	GLib.SList, an existing radio button group, or null
	if you are creating a new group.

So just put in null:

button1 = new RadioToolButton(null);
button2 = new RadioToolButton(button1);

I guess you'd put in the label text using the inherited (from ToolItem)
"Label" property...

Hope this helps :)

Funny thing, looking in the svn, I can only see a custom file for
RadioButton and for RadioMenuButton... RadioToolButton are apparantly
unknown...
(http://svn.myrealbox.com/viewcvs/trunk/gtk-sharp/gtk/?rev=42992)

Wkr,

Anset.

Thomas Pryds Lauritsen wrote:
> Hi Anset
> 
> Thank you for your reply. I think I might not be saying clearly enough
> what it is that I want, though. I am talking about RadioToolButtons for
> placing in a Gtk.Toolbar, not plain RadioButtons. (RadioToolButton does
> not inherit from RadioButton)
> 
> 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.
> 
> | 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.
> 
> Thanks.
> Thomas
> 
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list