Re: gtkitemfactory radio menu items



On Monday 15 Apr 2002 10:57 pm, Owen Taylor wrote:
Ian Thompson-Bell <ian ruffrecords uklinux net> writes:

On Friday 12 Apr 2002 11:14 pm, Ian Thompson-Bell wrote:
How to I associate radio menu items, in a gtkitemfactory created submenu,
with a group?

TIA

Ian

I finaly managed to answer my own question.  It turns out GtkItemFactory 
assigns eaxh radiomenubutton its own seaprate group so you have to change 
this so the ones you want grouping are in the same group.  the way this is 
done is similar to grouping radiobuttons but you have separate functions to 
get and set the group.  So I wrote a function that appends a radiomenu button 
to a group:

From gtk+/demos/gtk-demo/itemfactory.c:

  { "/_Preferences/Color/_Red",               NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
  { "/_Preferences/Color/_Green",     NULL, gtk_ifactory_cb, 0, "/Preferences/Color/Red" },
  { "/_Preferences/Color/_Blue",      NULL, gtk_ifactory_cb, 0, "/Preferences/Color/Red" },

Regards,
                                        Owen



I finaly found this in the gtk 2.0 docs.  it does not appear to be in the gtk 1.2 docs.  Also, later in the 
same code
fragment we have:

{ "/_Preferences/Shape/_Square",        NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Shape/_Rectangle",     NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" },
{ "/_Preferences/Shape/_Oval",  NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" },

In this fragment the path is taken from the immeditaely preceding item whereas in your fragment they are both
taken from the first item.  I presume both are valid?

ian




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]