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

SpinButton and climb_rate



hi,

Using a spinbutton for entering a value, there is some mis-
behaviour according to my understanding that climb_rate in

GtkWidget * gtk_spin_button_new(
	GtkAdjustment  *adjustment,
	gfloat          climb_rate,
	guint           digits);

is meant to be the rate the value in the spinbutton changes
once an arrow is clicked. However, I encounter a strange 
behaviour with the code:

GtkObject *Speed_Adjustment;
GtkWidget *Speed_SpinButton;

void speed_spinbutton_activate( GtkWidget *entry )
    {    
    speed = gtk_spin_button_get_value_as_float
         ( GTK_SPIN_BUTTON( entry ) );
    /* do other stuff */
    }

Speed_Adjustment =  gtk_adjustment_new 
    ( motor_speed, -6000, 6000, 0.001, 1, 10 );
Speed_SpinButton = gtk_spin_button_new 
    ( GTK_ADJUSTMENT (Speed_Adjustment), 100.0, 3 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( Speed_SpinButton), TRUE );
gtk_object_set_data
    ( GTK_OBJECT (Xmcm_Window), "Speed_SpinButton", Speed_SpinButton );
gtk_fixed_put( GTK_FIXED( Xmcm_Container ), Speed_SpinButton, 120, 40 );
gtk_widget_set_usize( Speed_SpinButton, 100, 22 );
gtk_signal_connect( GTK_OBJECT( Speed_SpinButton ), "activate", 
    GTK_SIGNAL_FUNC( speed_spinbutton_activate ), Speed_SpinButton );

The value should increment by 100.0, but it does this by 0.001,
and somtimes it jumps by 100.0. Additionally, I cannot enter any 
value even if the limit and increments of the GtkAdjustment object 
are fulfilled.

Is there something I did not respect?
-- 
Dr. Peter Wurmsdobler

      CTM - Centre de Transfert des Microtechniques
39, av. de l'Observatoire, BP-1445, 25007 Besancon CEDEX 3
TELEPHONE: +33 3 81 47 70 20  TELECOPIE: +33 3 81 47 70 21
                E-mail: peterw@cetehor.com

                  Ceterum censeo MIRCOSOFTem esse delendam.



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