Re: GTK Progress bar: assistance pls.





å 2008-01-07äç 13:18 +0530ïvijayasarathy setsindia netåéï
        for(i=start_count;i<end_count;i++)
        {
                //g_print("i = (%d)\n",i);
                while(j<100000)//To kill time, keep counting until a
lakh
                        j++;
                j = 0;//Make j 0 for the next loop.
                //sleep(2);
                pdata->fraction = (gdouble)i/(gdouble)(range);

                fflush(NULL);
                //gtk_progress_bar_pulse (GTK_PROGRESS_BAR
(pdata->pbar));
                //gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR
(pdata->pbar),pdata->fraction );
                gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR
(pdata->pbar),
pdata->fraction);
        }//End for i = start_count to end_count 

For this code snippet, you update all your progress in the loop and not
yield the control to gtk_main(), this is the problem.

You should not write code like this, using a timer to update the
progress bar instead of this loop, otherwise the drawing instruction
will be pending due to your full control of CPU.

Bin




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