Re: GtkAdjustment Callback Parameters are Swapped



From: "Bradley F. Hartman" <hartman mcci-arl-va com>
>
> Hello,
>
> I have found that the parameters that GTK passes to the callback for
> adjustments are swapped (reversed from what the prototype indicates they
> should be).  The documentation for the prototype for the callback
> for the "value-changed" signal for the GtkAdjustment class follows:

It's not the signal, it's how you're connecting to it.

> I then registered my callback, as shown below:
>
>         printf( "main:  hadjustment created.  Adjust = 0x%p.  Data = 0x%p.\n",
>                 hadjustment,
>                 (gpointer)0x1234
>               );
>         gtk_signal_connect_object(
>                            GTK_OBJECT( hadjustment ),
>                            "value-changed",
>                            (GtkSignalFunc)value_changed_callback,
>                            (gpointer)0x1234
>                                  );

gtk_signal_connect_object() connects the callback with a flag
enabled that switches the position of the gpointer "data"
value and the GtkAdjustment "object" value in the callback.
The positions of any other values passed to the callback
are unchanged.

Note that this is not the same as the behavior of the
gtk+-2.0 g_signal_connect_object(), which does
something quite different.

To get the callback arguments in the same order as the prototype,
use gtk_signal_connect() (note, no _object).

Ron Steinke



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