Re: [gtk-list] Getting the label from gtk_radio_menu_item_new_with_label()



Andy Kahn wrote:
> 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() ?

Hi Andy, I do something like:

	GtkWidget *child = GTK_BIN( wgt )->child;
	char *txt;

	g_return_if_fail( child != NULL );
	g_return_if_fail( GTK_IS_LABEL( child ) );

	gtk_label_get( GTK_LABEL( child ), &txt );

HTH, John
--
John Cupitt, john.cupitt@ng-london.org.uk, +44 (0)20 7747 2570
VASARI Lab, The National Gallery, Trafalgar Square, London, WC2N 5DN



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