Navigation: thinBasic Modules > UI (User Interface) > DIALOGSs > DIALOG DOEVENTS |
|
Description
Process pending window or dialog messages for MODELESS dialogs.
If there are no pending messages, DIALOG DOEVENTS pauses execution of the current thread for msSleep milliseconds time.
Syntax
DIALOG DOEVENTS [msSleep] [TO Counter]
Returns
None
Parameters
Name |
Type |
Optional |
Meaning |
msSleep |
Number |
No |
Number of milliseconds current thread will be paused. If not specified, 1 millisecond will be assumed. |
Counter |
Variable |
Yes |
A numeric variable that will receive the number of active dialogs |
Remarks
DIALOG DOEVENTS is usually used to create a "message pump" for modeless dialogs.
If the optional TO clause is included, the number of active dialogs is returned in the Counter variable, once all of the pending messages have been processed.
Restrictions
The DIALOG DOEVENTS loop must run for the duration of the modeless dialog(s), or they will not respond correctly.
See also
Examples
'----------------------------------------------------
'---Single modeless dialog message pump example.
'---(Assume dialog already created with DIALOG NEW ...)
'----------------------------------------------------
DIALOG SHOW MODELESS hDlg Call DlgCallback
Do
DIALOG DOEVENTS 0 To Count&
Loop While Count&
' Application code continues here...
'----------------------------------------------------
'----------------------------------------------------
'---Multiple modeless dialog message pump example.
'---In some applications, the number of modeless dialogs can vary,
'---we want to break the message loop when the 'main' dialog is closed.
'---(Assume dialogs already created with DIALOG NEW ...)
DIALOG SHOW MODELESS hMainDlg Call DlgCallback
DIALOG SHOW MODELESS hChildDlg1
DIALOG SHOW MODELESS hChildDlg2
...
Do
DIALOG DOEVENTS
DIALOG Get SIZE hMainDlg To x, x
Loop While x '---When x = 0, dialog has ended
' Application code continues here...
'----------------------------------------------------
© 2004-2008 thinBasic. All rights reserved. | Version 1.7.0.0 | Web Site: http://www.thinbasic.com |