Re: Progress bar waiting too long?



* warder@pcisys.net (warder@pcisys.net) wrote:
> 
> 
> So here I am loading a bunch of images at and scaling them in one large
> cluster.  This, of course takes a while.  So I thought, 'hey I'll use a
> progress bar so that people will know something is going on'.  My problem is
> that the progress bar wont show up until the images are done loading rendering
> it pointless. Here is what I do:
> 
> /* Make the window and the progress bar and add it to the window*/
> gtk_widget_show_all(window);
> displayimages(); /* This makes the images and puts them in a frame in the 
> window it also updates the progress bar everytime a pic is done */
> 
> I've tried explicitly showing the bar with gtk_widget_show and
> gtk_widget_show_now but they dont help.
> 
> Any thoughts on what I did wrong?
> 
>                                         -Govind Salias

AFAIK, the changes to the status-bar value will not visually take
effect until the next time gtk_main is entered.

After updating the progress bar, try adding:

while(gtk_events_pending())
    gtk_main_iteration();

That should redraw everything for you.

(There are other solutions, including timers etc, but I am drawn to
two-liners).

Tom.
-- 
            .-------------------------------------------------------.
    .^.     | Tom Gilbert, England | tom@tomgilbert.freeserve.co.uk |
    /V\     |----------------------| www.tomgilbert.freeserve.co.uk |
   // \\    | Sites I recommend:   `--------------------------------|
  /(   )\   | www.freshmeat.net www.enlightenment.org www.gnome.org |
   ^^-^^    `-------------------------------------------------------'



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