On 5 Jun 2009, at 17:13, Tom Smith wrote:
> I converted a c++ CLI program to a GUI program using FLTK. It's a  
> very simple program that lists the contents of a folder. It's  
> equivelent to a Unix ls command or a Windows dir command. It works  
> OK, but when the folder contains a lot of files, the GUI hangs for  
> several seconds and then finally displays the listing.
>
> I'm using a Fl_Browser to output to. I do this output->add 
> (item.c_str()) Perhaps this is incorrect? I've tried win->redraw()  
> and a few other things, but it still hangs. Maybe I need to do  
> threads? I'm not sure. This is my first GUI app. Everything  
> displays correctly after the hang and all the buttons work, etc. So  
> overall it's a success.
>
> Any ideas on how to fix the hang?

Without seeing your code, I'm assuming that you are adding all the  
files in a big loop, that doesn't give the GUI a chance to update.  
So, whilst the loop is doing its thing, no GUI refreshes can occur  
and your program seems unresponsive?
Does that sound about right?

If so, it may be enough to just call Fl::wait(0) every 20 or so adds,  
see if that helps.





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

Reply via email to