Re: [gtk-list] Getting the label from gtk_radio_menu_item_new_with_label()
- From: Vlad Harchev <hvv hippo ru>
- 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: Fri, 14 Apr 2000 10:21:08 +0500 (SAMST)
On Wed, 12 Apr 2000, Andy Kahn wrote:
> I'm borrowing the code from testgtk.c which looks similar to the
> following:
>
> static GtkWidget *
> build_option_menu(...)
> {
> ...
> omenu = gtk_option_menu_new ();
> menu = gtk_menu_new ();
> group = NULL;
> for (i = 0; i < num_items; i++)
> {
> menu_item = gtk_radio_menu_item_new_with_label (group, labeltext);
> gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
> (GtkSignalFunc) my_callback, data);
> ...
> }
> ...
> }
>
> In the callback function, the first parameter should be the menu item
> widget. That is:
>
> void
> my_callback(GtkWidget *wgt, gpointer cbdata)
> {
> ...
> }
>
> "wgt" should point to the "menu_item" widget from up above.
>
> 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() ?
I didn't check - but any menuitem is a GtkBin (including GtkRadioMenuItem),
so probably GTK_BIN(wgt)->child will provide you the label or whatever you
used. Just a guess.
> any help would be appreciated,
> --andy
>
>
Best regards,
-Vlad
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]