On 13.03.2012 15: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.
Fl::check() is definitely the way (or one possible way) to go, if you do long processing and want to show progress. However, if you call Fl::check() for each line you read from a file, this might be too much and lead to performance degradation. In the example of a file, you would maybe know the number of lines (or bytes in the file) in advance, so that you can calculate the progress (in %). Then, do only call Fl::check() if this changes significantly (e.g. 1, 2, or 3 %). This should be enough to reduce the performance degradation and show a useful progress bar. In other cases, it depends on what you are doing and how frequently you need to update the window. Albrecht _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

