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: 13 Apr 2000 19:45:47 -0400
Andy Kahn <email@example.com> writes:
> My question is this: how can get at the label widget which is created
> as part of the menu item from gtk_radio_menu_item_new_with_label() ?
Hmm, the FAQ guys should get on this one.
All the *_new_with_label() convenience functions simply pack a
GtkLabel widget into the widget being created. To get the GtkLabel,
the official accessor function is gtk_container_children(), but
GTK_BIN(menuitem)->child is also a supported way to access the child
of a GtkBin.
Note that code written this way is somewhat fragile. (If you later
change your code so it packs a pixmap into the menu item as well, the
callback breaks, with no compile errors or anything.) If this bothers
you, you can create the label manually, pack it in the menu item, and
pass the label pointer explicitly via callback data or object data.
] [Thread Prev