Does anyone know where I can find some short examples of how to
create/use option menus? Unfortunately, I need a little more to go on
than gtkoptionmenu.c... :)Thanks,
Actually, it is not documented in the tutorial. I was probably
like you, looking for explanation.
So this is a first help, I'm not at work, so I don't have the code right under the hand, so I tell it by memory,
To create an option menu, first build an option menu, just like
normally, by using the function
cond_option=gtk_option_menu_new();
Then create a simple menu by
menu=gtk_menu_new();
Then put into this menu some menu item with the
menu_it2=gtk_menu_item_new_with_label("The
first label");
gtk_widget_show(menu_it2);
Then use this function to put it into the menu :
gtk_menu_append(GTK_MENU(menu),menu_it2);
Then, attach the menu into the option menu :
gtk_option_menu_set_menu (GTK_OPTION_MENU(cond_option), menu);
gtk_widget_show(cond_option);
Of course, don't forget to show all the widgt you've just created, and then place it where you want, in a table, in a box, in a container, anywhere is good, it acts like another widget !
Normally, it should be right, but I'm not quite sure.
To resume it : you need three type of widget
1) the option menu
2) the menu
3) the menu items
1) Create the items, as many as you want
2) put them into the menu
3) attach the menu into the option menu.
you are !
Bye
And happy gtking !
Bruno