Re: gtkitemfactory radio menu items
- From: Ian Thompson-Bell <ian ruffrecords uklinux net>
- To: Ian Thompson-Bell <ian ruffrecords uklinux net>, gtk-app-devel-list gnome org
- Subject: Re: gtkitemfactory radio menu items
- Date: Mon, 15 Apr 2002 22:28:37 +0100
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:
GSList * appendmenuradiobutton(GtkItemFactory * factory, const gchar * path,
GSList * group, gint check)
{
GtkWidget * aradiobutton;
aradiobutton = gtk_item_factory_get_widget(GTK_ITEM_FACTORY(factory), path);
gtk_radio_menu_item_set_group(GTK_RADIO_MENU_ITEM(aradiobutton), group);
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(aradiobutton), check);
return(gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(aradiobutton)));
}
You pass this the factory, the path to the radiomenubutton, a GSList pointer
and TRUE/FALSE to determine if it is initialy checked or not. To group three
radiomenubuttons just:
GSList * group;
group = NULL;
group = appendmenuradiobutton(GTK_ITEM_FACTORY(factory),
"/pathtofirstradionbutton", group, TRUE);
group = appendmenuradiobutton(GTK_ITEM_FACTORY(factory),
"pathtosecondradiobutton", group, FALSE);
group = appendmenuradiobutton(GTK_ITEM_FACTORY(factory),
"pathtothirdmenubutton", group, FALSE);
Hope someone finds this useful. Maybe it should even appear in the gtkref??
Ian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]