option_menu with show_toggle set to TRUE



I'm writting an OptionMenu (you can see part of the code below). 
I create a menu, add radio_menu_item's to it, set the show_toggle flag
to TRUE and use finally
"gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu),2);" to show
"Option 3" as the default value.

The problem is, when I press my option_menu widget the toggle button
which appears "pressed" is at the beginnin always the first menu item,
"Option 1", and not "Option 3" as I expected. 
How can I solve this?

Thanks in advance,
	Ignacio Nodal

[...]

 menu = gtk_menu_new();

 menu_item = gtk_radio_menu_item_new_with_label(group,"Option 1");
 group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM(menu_item));
 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM (menu_item),
TRUE);
 gtk_menu_append(GTK_MENU (menu), menu_item);
 gtk_widget_show(menu_item);

 menu_item = gtk_radio_menu_item_new_with_label(group,"Option 2");
 group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM(menu_item));
 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM (menu_item),
TRUE);
 gtk_menu_append(GTK_MENU (menu), menu_item);	 
 gtk_widget_show(menu_item);

 menu_item = gtk_radio_menu_item_new_with_label(group,"Option 3");
 group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM(menu_item));
 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM (menu_item),
TRUE);
 gtk_menu_append(GTK_MENU (menu), menu_item);
 gtk_widget_show(menu_item);	 
		 
 option_menu = gtk_option_menu_new();
 gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
 gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu),2);
 gtk_box_pack_end(GTK_BOX(vbox), option_menu, TRUE, TRUE, 2);
 gtk_widget_show(option_menu);	 

[...]




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