Re: GtkProgressBar



abhi rocks wrote:

hi

I was wanting to add a progress bar to a function, but
the problem is that progress bar is only shown after
the function is over even though the first thing i do
in the function is to show the progress bar. 

 

You need to give control back to GTK occasionally so it can update the
progress bar. In your main loop you need to do something like:

while (your main loop is running) {
    // do whatever you need to;
 
    // Update the progress bar position
    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(query->progress_bar),
percentage);

    // now let GTK update the progress bar
    while (gtk_events_pending())
        gtk_main_iteration();
}





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