Re: [gtk-list] Getting the label from gtk_radio_menu_item_new_with_label()
- From: Havoc Pennington <hp redhat com>
- To: Andy Kahn <ackahn netapp com>
- Cc: gtk-list redhat com
- Subject: Re: [gtk-list] Getting the label from gtk_radio_menu_item_new_with_label()
- Date: 14 Apr 2000 19:39:12 -0400
Andy Kahn <ackahn@netapp.com> writes:
> I did a little bit of investigation and modified the program from the
> code snippet I previously posted. Instead of having an assert on
> GTK_BIN(mitem)->child, I went ahead and simply printed the value of
> the pointer.
>
> When you run the code and change the menu item selection, you'll see
> output like:
>
> option_menu_cb() entered (cb is 'one')
> child is 0x80748b8
> option_menu_cb() entered (cb is 'two')
> child is 0x0
>
> Apparently, the "activate" signal for a menu item is triggered twice,
> once for the currently selected item, and then once for the newly
> selected item.
>
> I'm only interested in what the label text is after the new selection,
> but unfortunately, that menu item's child widget is NULL. (Hence the
> reason to my original email.)
>
> I'm sure there's a reason why this is happening, but whatever it is,
> I find the current behavior a little non-intuitive and a little
> inconsistent. Perhaps there's a different signal that I should be
> using?
>
Here's what's going on:
- radio menu items in an option menu are probably a little silly,
since the option menu already displays mutually exclusive options.
So, it's likely you can just avoid the whole problem. testgtk
is only doing this as a torture test, not a UI suggestion.
- I believe you want "toggled" instead of "activate"; "toggled"
is somehow chained out to "activate" which is why you get
an extra activate (the unselected item gets toggled off).
Don't ask me.
- Your child is missing, because the currently-active child is
removed from the menu item and displayed in the option menu
button.
Kind of weird, but I think if you use "toggled" or don't use radio
items in option menus it will all go away.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]