Re: How can I use g_signal_connect() to pass a gponiter parameter
- From: "Tristan Van Berkom" <tvb gnome org>
- To: learning_gtk <learning_symbian hotmail com>
- Cc: gtk-list gnome org
- Subject: Re: How can I use g_signal_connect() to pass a gponiter parameter
- Date: Fri, 22 Aug 2008 11:12:02 -0700
Go look again at the docs for the radio item's "activate" signal, are you
sure that the callback only takes one paramater ?
also, gpointer implies a void pointer, no need to cast (void **) pointer to
pointer, just (gpointer) will do instead of (gpointer *) (but your code will
still work without that change).
Cheers,
-Tristan
On Fri, Aug 22, 2008 at 5:36 AM, learning_gtk
<learning_symbian hotmail com> wrote:
>
> I hope to use g_signal_connect() to pass a gchar* parameter like this:
>
> gchar* radio1= "Radio1"; //it is global variable
> gchar* radio2= "Radio2";
> gchar* radio3= "Radio3";
>
> void item_radio_print1(gpointer* data)
> {
> g_print("This is the radio %s\n", (gchar *)data);
> }
>
> g_signal_connect(G_OBJECT(item_radio1), "activate",
> GTK_SIGNAL_FUNC(item_radio_print1), (gpointer*)radio1);
> g_signal_connect(G_OBJECT(item_radio2), "activate",
> GTK_SIGNAL_FUNC(item_radio_print1), (gpointer*)radio2);
> g_signal_connect(G_OBJECT(item_radio3), "activate",
> GTK_SIGNAL_FUNC(item_radio_print1), (gpointer*)radio3);
>
> But, those strings can not be printed.
>
> Please help me. Thanks!
> --
> View this message in context: http://www.nabble.com/How-can-I-use-g_signal_connect%28%29-to-pass-a-gponiter-parameter-tp19106328p19106328.html
> Sent from the Gtk+ - General mailing list archive at Nabble.com.
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]