A question about GTK Scale



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




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