[Glade-users] Spin buttons.....

vavaux ulb ac be wrote:

Hello, I'm trying to use spin buttons to send value of the button to
variables in my program but I didn't succeed well...

I've use the standard commands found in the faq but I have some trouble.

Here is the code I used:

on_preferences1_activate        (GtkMenuItem    *menuitem,
                                 gpointer        user_data)
   GtkWidget *prefs;
   GtkWidget *value;

   prefs = create_sizelattice ();
   gtk_widget_show (prefs);

   value = lookup_widget (prefs, "spinbutton1");
   gtk_signal_connect (GTK_OBJECT (GTK_RANGE (value) -> adjustment,
"changed", GTK_SIGNAL_FUNC (on_spin_button1_changed);


The function on_spin_button1_changed was directly generated by glade
using properties -> signal but it's not alreday implemented. The
'sizelattice' is a dialog window that work fine except spinbuttons
inside it.

While compiling, I obtained:

In function "on_preferences1_activate":
tow few arguments to function 'gtk_signal_connect'
error 1

So what did i wrong ?

You missed out a ')', and forget the 'data' argument to gtk_signal_connect.
Try this:

    gtk_signal_connect (GTK_OBJECT (GTK_RANGE (value) -> adjustment),
      "changed", GTK_SIGNAL_FUNC (on_spin_button1_changed), NULL);

Another question ... what represent 'adjustment' ?

A GtkAdjustment - it just encapsulates a value which can be set and which
emits a signal when it is changed.


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