On 03/13/12 07:14, Furqan wrote:
> Actually I have already spent so much time to configure progress bar of FLTK.
> but i couldn't manage it out.. I just want that when i open any file, by
> reading lines from the file, progress bar will show the percentage of
> completed lines.
>
> but when the file reading loop starts, Fl::check() make time interval i think
> so. progress bar is showing without any problem. but the speed of line
> reading is reduced 100 times may be. I don't know whats wrong with it. How
> can i make a real-time progress bar that works in real-time. real-time means
> if i print out something from a loop, progress bar should show the same
> percentage and timing as cout or printf shows.
If you're showing percentages, only update the progress bar
when the percentage digit changes. eg:
int last_percent = 0;
while ( ..load file line loop.. ) {
percent = (int)((float)line / total_lines * 100.0 + .5);
if ( percent != last_percent ) { // integer percentage changed?
..update progress bar + Fl::check()..
last_percent = percent;
}
}
This way you only update at max 100 times no matter
how large the file is.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk