Re: Getting value from an option menu
- From: Carlos Pereira <carlos pehoe civil ist utl pt>
- To: gtk-app-devel-list gnome org
- Subject: Re: Getting value from an option menu
- Date: Fri, 2 Mar 2001 16:00:25 GMT
Hello. I'm just starting to learn GTK+ programming and am having
trouble figuring out how to get the value the user has selected
on an option menu.
This is how I do it:
Carlos
GtkWidget *option_menu, *menu, *menu_item, *menu_item_active;
option_menu = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "option_menu_something");
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
menu_item_active = gtk_menu_get_active (GTK_MENU (menu));
menu_item = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "menu_item_a");
if (menu_item == menu_item_active) do_this ();
menu_item = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "menu_item_b");
if (menu_item == menu_item_active) do_that ();
etc...
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]