Re: A question about GTK Scale



Perhaps it takes 2 iterations of the main loop for the vscale to update.
What happens if you try
while(gtk_events_pending()) gtk_main_iteration();
instead?

Ke Jin wrote:
Dear All,
  I have a VScale in my interface and I created button named "Play" that
once the button is clicked, the scale will move automatically.
Below is the function connected to the button. And it performed strangely.
The scale was not updated every iteration of the loop, which means the value
of the scale changed from 0 to 2 then to 4 then 6....and jumped over
1,3,5...

Does anyone have any idea why this happened?

void playClick(GtkWidget *widget, VScale *slider)
{
    double interval = 1;
    double currentTime =  gtk_range_get_value((GtkRange*)(slider));
while(currentTime<=20)
    {
currentTime += interval; usleep(1000000);
        printf("current Time: %f\n",currentTime);
        gtk_range_set_value((GtkRange*)(gtkE->slider),currentTime);
        gtk_main_iteration();
    }
}
Many Thanks,
Ke

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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