Re: questionfor progress bar



Oops, It doesn't work, What's the problem.. ?

I describe in detail.

/* pseudo code*/

gboolean * show_bar_idle_cb(pointer  val)
{
 gtk_progress_bar_set_fraction(POINT_TO_INT(val));
 return FALSE to exit the idle

}
/* and the for loop */
double val;
for(i = 0; i< SOME_NUMBER; i++)
{
  val = (100.0 /SOME_NUMBER)* i /100.0;
  g_idle_add(show_bar_idle_cb, INT_TO_POINT(val));
**SOMEWORK**
}

The problem is that timeout events don't occured before finishing
SOMEWORK(read file with fscanf) . so I can see only the progress bar
that fully filled and nothing filled.

--------------
double val = 0;
  g_idle_add(show_bar_idle_cb, INT_TO_POINT(val));
for(i = 0; i< SOME_NUMBER; i++)
{
  val = (100.0 /SOME_NUMBER)* i /100.0;
**SOMEWORK**
}
--------------
upper codes don't work too.

2006/11/5, Kim Jongha <kim jongha gmail com>:
Greeting,

progress bar is updated "only" using timeouts ?

I read some big file and want to show up the progress how much App.
read file. so I use progress bar like below


double val;
for(i = 0; i< SOME_NUMBER; i++)
{
   val = (100.0 /SOME_NUMBER)* i /100.0;
  gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pbar), val);
   gtk_widget_show(pbar);
}

No error, 'val' value is greater than 0.0 less than 1.0. but it
doesn't work while app. read file. when app read file completly, then
progress bar filled fully is shown up.
I try to use timeouts, and that how can I read file.. ?

give me a advise, thank you.




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