[Gambas-user] about process

Benoit Minisini gambas at ...1...
Fri Dec 5 20:13:13 CET 2003


On Wednesday 03 December 2003 18:39, ron wrote:
> Hi All,
>
> Rob:
> You recently mentioned the WAIT as alternative for VB's DoEvents for a wait
> process. Be carefull for the difference. As I understand from documentation
> the WAIT does a wait for Gambas, the interpreter wait the time and nothing
> else is executed in the interpreter (i.e. other events ) in the program
> using this WAIT function.
>
> With VB DoEvents this behaviour is different, other buttons can be pressed
> and those events are executed.
>
> VB's DoEvents let the events in the programm working but also windows
> background processes.
>

The Gambas behaviour relies on a QT feature, that allow processing events 
without interaction.

The VB way is horrible, because it leads easily to infinite loops or strange 
behaviours in the code.

When you WAIT in a program, you don't want the user to interact with the 
application. If you want that, just return to the event loop. If you can't, 
then your program may be badly written.

> VB's Sleep (or Delay, i forgot)  holds everything, events in the program
> and all other programs in windows!. Can't move Notepad window.
>
> Gambas WAIT keeps the whole program waiting till the wait time is passed.
> Other program stay working!. Can move Kedit window.

This behaviour comes from X-Window and the multitasking kernel, not Gambas !
Forget Win9x man :-) On Window NT, you can do the same thing, except that some 
badly written application like Explorer can block when trying to access a 
network share for example.

>
> In VB you can use
>
> textbox.text="Check the checkbox GO to continue at the same moment"
> do while checkbox_go=false
>   DoEvents
>   passes=passes+1
> loop
> textbox.text="Thank You"
>
> and use a checbox to stop this waiting and passes has a very big value.
>
> textbox.text="Check the checkbox GO to continue, may be a delay of 10 sec"
> do while checkbox_go=false
>   WAIT 10
>   INC passes
> loop
> textbox.text="Thank You"
>
> You must be lucky to check the GO because only at a interval of 10 seconds
> the WHILE condition is tested and the time after the WAIT till this test is
> a few miliseconds. The passes is only every 10 second incremented
>
> You can't use WAIT 10 in a seperate form to monitor every 10 seconds
> changes somewhere as was the intention by the person asking about it and
> keep the application creating this form continue other tasks. He should use
> a timer object in that form.
>

-- 
Benoit Minisini
mailto:gambas at ...1...





More information about the User mailing list