> I know that to keep ui responsive (or update itself) we can > use Fl::check() in intensive computation loops. However, when > such loops are not written by ourselves, for instance when > using an external libraries, it is not possible to insert > this statement into the loop body. > > In my case I'm doing image loading/saving operations using > external libraries and I would like to keep the ui responsive > while the image is being loaded or saved. How can I ensure a > responsive behavior in such a case?
This may not be the popular suggestion - but for this sort of problem I usually start a worker thread to do the loading (or storing) of the data, and allow the main thread to go on servicing the GUI. You need to add some mechanism to signal between the threads so the main thread knows when the worker thread is done. That doesn't have to be anything fancy though - simply using add_timeout() to add a callback to the main thread to poll for a flag from the worker is usually enough. SELEX Sensors and Airborne Systems Limited Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL A company registered in England & Wales. Company no. 02426132 ******************************************************************** This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. ******************************************************************** _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

