Radio_Menu_Item problem in 0.99.8



This is my first contribution to this list - please be kind if I tread
on anyone toes / break the list conventions etc. Hopefully what I have to
say will be important!

Basically - there's (apparently) a bug in radio-menu-items:
Here's a fragment of code to build a set of three such items in a submenu:
 
	submenu = gtk_menu_new();	/* we don't do gtk_widget_show() on this */
	submenu_item = gtk_radio_menu_item_new_with_label(NULL, "Planetary Data");
	viewoption = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(submenu_item));
	gtk_menu_append(GTK_MENU(submenu), submenu_item);
	gtk_widget_show(submenu_item);
	submenu_item = gtk_radio_menu_item_new_with_label(viewoption, "Separations");
	gtk_check_menu_item_set_state(GTK_CHECK_MENU_ITEM(submenu_item), 1);
	gtk_menu_append(GTK_MENU(submenu), submenu_item);
	gtk_widget_show(submenu_item);
	submenu_item = gtk_radio_menu_item_new_with_label(viewoption, "Other");
	gtk_menu_append(GTK_MENU(submenu), submenu_item);
	gtk_widget_show(submenu_item);
	
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(view_menu), submenu);

When you display the finished main menu and try and use it, the default-button
(which I set with 'gtk_check_menu_item_set_state()' above) acts more like a
check button than a radio button.

It is possible to set one other of the radio buttons on at the same time as it.
If another button *is* on, then selecting the default button causes it to act
as a check button. If the default button is the only one of the set selected,
then it refuses to be un-set.

So it's a bit like a check button that knows about the other radio buttons!

BTW - this same thing happens without the call to 'gtk_check_menu_item_set_state()',
in such a case then it's the first of the radio buttons that acts strangely.

PS: why isn't there a 'gtk_radio_menu_item_set_state()' call?

--

Steve                                       | Steve's law of House Rewiring:
S.Hosgood@swansea.ac.uk                     | "No matter how many power sockets
Phone: +44 1792 297292 + ask for Steve      |  you fit in a room, you will run
Fax:   +44 1792 295811                      |  out within the first week of use
--------------------------------------------+  even if you took Steve's law of
http://iiit.swan.ac.uk/~iisteve/steve.html  |  House Rewiring into account"




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