[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Spin button problem
- From: Bart Vandewoestyne <Bart Vandewoestyne skynet be>
- To: "gtk-app-devel-list redhat com" <gtk-app-devel-list redhat com>
- Subject: Spin button problem
- Date: Sun, 20 Feb 2000 11:50:08 +0100
I'm having the following spin button problem:
I have attached two spinbuttons to a horizontal buttonbox. I want to be
able to change the value of one spinbutton without changing the value of
the other. Now, for some strange reason that i didn't find yet, when i
change the value of the first spinbutton, the value of the SECOND
spinbutton gets the same value! I don't know WHY this is, and would be
glad to get some hints on this one...
This is the code I use:
GtkWidget *mot_new_control_widget(void)
{
GtkWidget *control_table;
...
GtkWidget *hbox;
GtkWidget *label_clock_low, *label_clock_high;
GtkWidget *clock_spin_high, *clock_spin_low;
GtkObject *clock_adj;
...
hbox=gtk_hbutton_box_new();
clock_adj=gtk_adjustment_new(1000, 0, 10000, 250, 100, 0);
label_clock_high = gtk_label_new("Clock Up Time: ");
gtk_box_pack_start_defaults(GTK_BOX(hbox), label_clock_high);
clock_spin_high=gtk_spin_button_new(GTK_ADJUSTMENT(clock_adj), 100, 0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(clock_spin_high),
mot_clock_time_high);
gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(clock_spin_high),
GTK_ADJUSTMENT(clock_adj));
gtk_box_pack_start_defaults(GTK_BOX(hbox), clock_spin_high);
label_clock_low = gtk_label_new("Clock Low Time: ");
gtk_box_pack_start_defaults(GTK_BOX(hbox), label_clock_low);
clock_spin_low=gtk_spin_button_new(GTK_ADJUSTMENT(clock_adj), 100, 0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(clock_spin_low),
mot_clock_time_low);
gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(clock_spin_low),
GTK_ADJUSTMENT(clock_adj));
gtk_box_pack_start_defaults(GTK_BOX(hbox), clock_spin_low);
gtk_widget_show_all(hbox);
gtk_table_attach_defaults(GTK_TABLE(control_table), hbox, 0, 3, 1, 2);
gtk_signal_connect(GTK_OBJECT(clock_spin_high), "changed",
GTK_SIGNAL_FUNC(mot_set_clock_high_time), NULL);
gtk_signal_connect(GTK_OBJECT(clock_spin_low), "changed",
GTK_SIGNAL_FUNC(mot_set_clock_low_time), NULL);
return control_table;
}
void mot_set_clock_high_time(GtkWidget *widget, gpointer user_data)
{
mot_clock_time_high=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
g_print("mot_set_clock_high_time has run\n"); // for debugging;
}
void mot_set_clock_low_time(GtkWidget *widget, gpointer user_data)
{
mot_clock_time_low=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
g_print("mot_set_clock_low_time has run\n"); // for debugging;
}
The variabeles mot_clock_time_high and mot_clock_time_low in the last 2
functions are global variabeles that hold the time a clock pulse that is
sent to the parallel port is high or low. I want to be able to change
these parameters in my program by using spinbuttons.
What am I doing wrong?
--
Bart Vandewoestyne http://hello.to/MC303
Hugo Verrieststraat 48 Bart.Vandewoestyne@skynet.be
8550 ZWEVEGEM ICQ# 21275340
BELGIUM - EUROPE nick: MC303
Phone: +32(0)56/75.48.11
-------------------------------------------------------------
"If we knew what it was we were doing, it would not
be called research, would it?"
-- Albert Einstein --
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]