Force GUI refresh

BlitzMax Forums/MaxGUI Module/Force GUI refresh

Blueapples(Posted 2007) [#1]
I have a loop that executes a script running behind a GUI window. Most of the window is updated okay, but if focus is switched to a different program while the script is running it often will not refresh properly. Are there any commands to force a repaint on a GUI window?

Also when updating a TextArea on the window, the text is not refreshed immediately.

My loop mainly consists of a call to the script library for to run the script for a time slice, then a call to WaitEvent(). I have set up a timer with CreateTimer(4) to execute four times a second so that the whole thing doesn't get locked up but won't take up 100% CPU. I'm not quite sure about this technique but it seems to work okay, except for this refresh issue.

The script engine I'm using is MicroC.


Azathoth(Posted 2007) [#2]
RedrawGadget?


Blueapples(Posted 2007) [#3]
To the extent my description was accurate, that seems to help. Looks like too much of what's going on is actually blocking the main thread (copying files, etc.), so what I really need is multiple threads. Oh well... I have some time to figure out a way around this.


assari(Posted 2007) [#4]
Take a look at eventhooks, there's a tutorial here or search the forum.


SebHoll(Posted 2007) [#5]
Looks like too much of what's going on is actually blocking the main thread


You may also want to use the PollSystem() function to allow the OS to do its stuff from time to time.


TaskMaster(Posted 2007) [#6]
Also, you can give time back to your app by doing stuff in small chinks.

For instance, if you need to copy a file, do it your self. Open the source, create the destination, read 1KB, write 1KB, let your loop run once, read 1KB, write 1KB, etc...