[Gambas-user] wait vs sleep confusion, console works, graphically have strange behabior

Tobias Boege taboege at ...626...
Sun Nov 10 22:14:45 CET 2013


On Sun, 10 Nov 2013, PICCORO McKAY Lenz wrote:
> i read the wiki and sleep its prefered, but sleep stop complete
> runtime, and wait i dont understand
> 
> in my program, the main Form, i change wait , and use sleep and then
> some message before run process (shell executing) do not show
> 
> either in the other program, only console, works ok! why?
> 

I don't completely understand your words but it's like that:

Sleep puts the program to sleep - literally. It just waits for a given time
to elapse and then resumes execution.

Wait, OTOH, keeps the interpreter active by recursively calling the event
loop. This way, events can fire, the GUI can be updated, etc..

So yes, if you use Sleep, the program will "freeze" for the given time while
with Wait you can still have your forms redraw themselves and stuff.

The thing with the console you mentioned maybe happens as follows (you
didn't really provide details): you call an external program through Shell
which is not affected by your program being asleep. If you don't catch the
output from the Shell instruction (or redirect it), it will be shown in the
IDE console, no matter if your program is Sleeping or whatever.

Regards,
Tobi




More information about the User mailing list