How to fire maxgui hooks during long operation?
BlitzMax Forums/MaxGUI Module/How to fire maxgui hooks during long operation?
| ||
I have a potentially large manipulation of data to process in my app and I was wondering how to successfully process this without freezing out the window. The trigger to activate the long operation happens via a custom event message sent. There is an event hook setup to read this event and within the event hook it then performs the long task. I can't seem to find any way to give a slice of time back to maxgui/os in order for things to update and so the windows do not freeze. I have a custom progress bar gadget that updates via a timer in order to indicate that the application is "working". What command/technique do I use in order to let this timer tick mid long operation for/next loop? I tried PollSystem() and it did not work. Is it possible to do pollsystem from within an EventHook? Last edited 2011 |
| ||
Heh answered my own question maybe (after some hours last night looking and today)! It appears the PollSystem function doesn't poll if its already "polling". Function PollSystem() If _busy Return _busy=True Driver.Poll _busy=False End Function So in my code I can just do Driver.Poll() Does anyone know of any side effects? Last edited 2011 |
| ||
I think that's also the solution to one of the problems I've got! Before I could call PollSystem again and it would return some time to the redrawing of the gadgets, but no more. Going to try this one out myself as well! Is _busy being accessed anywhere else as well? Perhaps something with thread safety? Edit: Awesome! This totally works for me! Last edited 2011 |
| ||
Hurrah good stuff! I havnt noticed any weird crashes after a day of heavy coding so all seems stable! The only other placed it seemed to be used is in waitevent() |
| ||
For the WaitEvent (and perhaps WaitSystem?) I can understand why it wouldn't do anything if it's "_busy". But for the PollSystem (and PollEvent?) stuff I'd say it should skip these "busy"-checks, no? Perhaps one of the MaxGui coders can clarify? |
| ||
sounds sensible... ? |
| ||
I've been thinking about installing previous BlitzMax versions just to create a Diff between them to see if and or when this change was made. I always though it was due to the OS. I remember it working perfectly on Windows XP, but when I started using Vista it started to play up. |