Re: progress bar



On Tuesday 03 February 2004 08:37, z2274394 student unsw edu au wrote:

I have a progress bar setup with a timeout function. A callback function
(another widget) has a for loop and in it, it updates a global variable. I
then try to use this global variable to update my progress bar via the
timeout function. It doesnt work, the for loops get finished and then the
timeout gets excuted afterwards. Is there a way to get around it, ie
monitor some for loop execution


see  http://www.gtk.org/faq/#AEN602

Basically, just put a 

    while (g_main_context_iteration(NULL, FALSE));

inside your for loop somwhere, possibly surrounded by something like an  

  if ((i & 0xff) == 0)
  {
     while ...
  }

to make sure g_main_context_iteration() is not called with every single 
iteration, but only after 256 iterations or so (depends on your specific 
context of course).

Cheers
-Tim




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