[Glade-users] Spin button ... need help



Valery Avaux wrote:

Hello,

I'm trying for the first to use Glade and I have only a few experience
in C programming...

I'm try to use spin button and scrollbars to send value to global
variables. I've tried some GtkSignal but none seems to work.. I suppose
I did it in a wrong way.

Could someone explain me how to send the value of my spin button
directly to a variable. For the scrollbar, I've got the same problem but
there i need to able to modify the value while the program is running.

You probably want to connect to the "changed" signal of the GtkSpinButton's
adjustment, as described in the FAQ:

4.9 How do I connect to GtkAdjustment signals?

Glade doesn't support this at present, but you can set it up manually, in a
similar way to question 3.6.

When you create the window, get a pointer to the widget containing the
adjustment, and connect to the "changed" or "value_changed" signals:

  window1 = create_window1 ();
  hscale = lookup_widget (window1, "hscale1");
  gtk_signal_connect (GTK_OBJECT (GTK_RANGE (hscale)->adjustment),
                      "changed", GTK_SIGNAL_FUNC (on_adjustment_changed),
                      NULL);

The scrollbar is similar.

Damon







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