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

Thomas Pryds Lauritsen pryds@duckburg.dk
Wed, 13 Apr 2005 23:08:44 +0200

Hash: SHA1


Sorry if this has been asked before, but I wasn't able to find it in the

I'm fairly new to Gtk# (but I like what I've seen so far). I'm trying to
use some Gtk.RadioToolButtons in a Toolbar, but I fail to see how to
create a group for them. I see that RadioToolButton has a constructor
that takes another RadioToolButton thereby getting the same group as
that one -- clever. But how does one then create the first
RadioToolButton of that group?

In some documentation I found for using Gtk in another language (I don't
remember which, unfortunately) it said that to create a button with a
new group you'd have to use an empty constructor. But the Gtk#
implementation doesn't seem to have this constructor.

http://xfc.xfce.org/docs/howto/html/toolbar.html seems (as far as I can
translate that code to C#) to suggest using null instead of another
RadioToolButton in the constructor of the first button. However doing so
yields a NullReferenceException and the button object is not created (if
one catches and ignores the exception).

If someone would post (or direct me to) a code snippet (or a working
example) in C#/Gtk# of how to create a series of RadioToolButtons of the
same group I'd appreciate it much.

Thank you in advance,
Thomas Pryds Lauritsen

Version: GnuPG v1.2.6 (GNU/Linux)