الرئيسية > lang > wait 
 en fr de es it nl pl pt pt_BR mk sq ca hu cs tr fa id vi ko ja ru zh zh_TW eo
السابق  التالي  تحرير  إعادة تسمية  تراجع  بحث  الإدارة  
المستندات  
تحذير! هذه الصفحة لم يتم ترجمتها.  See english version 
WAIT
WAIT [ Delay ]

Calls recursively the event loop.

If Delay is specified, the function does not return until Delay seconds elapse.

If Delay is not specified, the function processes all pending events and returns immediately. In that specific case, input events (keyboard and mouse) are ignored.

Delay is a floating point number. So, if you want to wait 100 ms, just do: WAIT 0.1

مثال

' Waits a little, letting the user interacts with the GUI
WAIT 0.1

' Waits, but the user can just watch what happens...
WAIT

If you call WAIT from an event handler, you may create infinite recursions, and then stack overflows.

For example, look at the following code:

PUBLIC SUB MySerialPort_Read()

  DIM sData, sTemp AS String
  DIM iTries AS Integer

  FOR iTries = 1 TO 5
    ' wait a bit and read response.
    WAIT 0.01
    ' see if we got some data.
    READ #LAST, sTemp, Lof(LAST)
    sData &= sTemp
    ...
 NEXT

END

WAIT is called without reading anything on the serial port. So it is yet ready for being read, and the Read event is raised recursively again and again until the stack is full.

In that case, you can solve the problem by using the SLEEP instruction instead.

إنظر أيضا

Event Loop