- Example of timeout
In french: Multitâche
Allows you to:
- define a timeout,
- give control back to Windows,
- give control back to Windows and to WLanguage.
MUST NOT be used to populate Looper controls, List Box controls or Multiline Zone controls. In this case, use a timer: an element is added into the control whenever the timer is called.
// Calculation loop
FOR i = 1 TO 10000
// Give control back to the system in order to display the results
// Wait 1 second
<Timeout>: Optional integer or optional Duration
Remark: This parameter can correspond to:
- Define a timeout: <Timeout> = positive integer.
The execution of the application is interrupted during <Timeout> hundredths of a second without giving control back to the system. The mouse clicks and the actions performed on the keyboard keys are ignored by the application. For example, the window can be moved but it cannot be resized.
The optional processes of controls are always run.
Remark: If <Timeout> = 1, the application gives control back to Windows without waiting during 1 hundredth of a second.
The modification of window size is not ignored. On the contrary, the mouse clicks and the actions on the keyboard keys are ignored.
The positive values are ignored on Android. If the parameter of the function is positive, it will be processed like a negative integer.
In PHP, the values of <Timeout> are rounded to the higher second. For example, if <Timeout> is equal to 125, the actual timeout will be equal to 2 seconds.
The positive values are not allowed.
- Give control back to the system: <Timeout> = 0 or is not specified.
The system ends the current processes, gives control back to the WINDEV, WEBDEV or WINDEV Mobile application, then takes into account the clicks and the actions performed on the keyboard keys.
Multitask has no effect if <Timeout> = 0.
The value 0 is not allowed on iPhone/iPad.
- Give control back to Windows and to the WLanguage: <Timeout> = negative integer.
The execution of the application is interrupted during <Timeout> hundredths of a second. Other processes can be run during this time period (redisplaying or running a click code for example). The interactions with the users (mouse click, keystroke, ...) are processed as usual.
Remark: If <Timeout> = -1, the application gives control back to Windows without waiting during 1 hundredth of a second.
- an integer corresponding to the number of hundredths of a second,
- a Duration variable,
- the duration in a readable format (e.g., '1s' or '10cs').
This parameter can only correspond to an integer.
Example of timeout
The user presses the Esc key before or during the call to Multitask:
- if <Timeout> is positive: The Esc key is ignored.
- if <Timeout> is equal to 0: The Esc key is taken into account at the end of current WINDEV processes.
- if <Timeout> is negative: The Esc key is immediately taken into account.
- To refresh the UI, use MultitaskRedraw.
- The events and timers started before the execution of Multitask are managed during the timeout.
- In a Service application, Multitask must be replaced with ServiceWait.
It is recommended to use ThreadPause
instead of Multitask
when using multiple threads (including the main thread of the application) if the timer does not need to process user actions.
Business / UI classification: UI Code
This page is also available for…