On 13.03.2012 16:39, MacArthur, Ian (SELEX GALILEO, UK) 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.
>
>
> I just tried this (demo attached, sorry it's so long) and I'm not seeing a 
> big performance hit - on this aged WinXP machine this rattles through a 300MB 
> text file in hardly any time at all; I'm not seeing a significant difference 
> whether I update the GUI or not...

Nice demo, works even on Windows.

I tried it with a 4 GB file, and I can confirm what you wrote.

However, when I reduced the interval of updates, i.e. changed
the line

   if((curr - last) > 3.0)

to something like

   if((curr - last) > 0.001)

I could see that the program ran much slower. It's almost like
having no "if...", i.e. updating the display after each read.

That's maybe more like the OP's problem... and it shows how to
solve it, as we suggested.

Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to