gtk progress bar and gdk_flush()



Hi,

I am working on the progress bar, I can't my progress bar updated in a
loop:
Even the gdk_flush() can't make it update on screen.


int done;
GtkWidget pg;
char msg[100];

for (done=0;done<100;done+=20){
      sprintf (msg,"%d was done" , done);
      gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pg),msg);
      gtk_progress_bar_set_fraction
(GTK_PROGRESS_BAR(pg),(double)(done)/100);
      gdk_flush();
      sleep(1); // do something take a long time.
}

Thanks.







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