Re: [gtk-list] Re: Gtk--: Item_Factory and Radio_Button group question



Hello,
   I ran into this problem a few weeks ago on my ftp client. If you want
to select a radio item in a itemfactory, here's one way to do it.

GtkItemFactoryEntry menu_items[] = {
   {"/FTP",		NULL,	0,	0,	"<Branch>"},
   {"FTP/Ascii",	NULL,	func1,	0,	"<RadioItem>"},
   {"FTP/Binary",	NULL,	func2,	0,	"<RadioItem>"}};
GtkWidget *ascii_widget, *binary_widget;

/* Create item factory here */
...

/* We'll get the actual widget for the 2 items */
ascii_widget = gtk_item_factory_get_widget(factory, menu_items[1].path);
binary_widget = gtk_item_factory_get_widget(factory, menu_items[2].path);

/* We can now set the state of them */
gtk_check_menu_item_set_state(GTK_CHECK_MENU_ITEM(ascii_widget), TRUE);

You may have to use gtk_radio_menu_item_set_group() on the widgets to make
the radio buttons function properly.

-------------------------------------------
Brian Masney <masneyb@newwave.net>
gFTP 0.21 - http://www.newwave.net/~masneyb
-------------------------------------------

On 6 Jan 1999, Guillaume Laurent wrote:

> Robert_Gasch/PeopleSoft@peoplesoft.com writes:
> 
> > 1) When I select an option from the View menu, 2 events are generated: one
> > for the old active choice, one for the new selected choice. Is there any
> > way to collapse these into 1 event or selectiveley only catch the event for
> > the radio button chosen by the user?
> >
> > 2) How can I make a radio button other than the first one I insert
> > the default of the group? I haven't been able to find a method of doing
> > this.
> 
> Both of these issues depend on gtk+ rather than Gtk-- in particular,
> especially 2). I couldn't find any documentation on the GtkItemFactory 
> either.
> 
> -- 
> 					Guillaume.
> 					http://www.worldnet.fr/~glaurent
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 



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