You need to force the events before the sleep starts with the
DO EVENTS
HTH,
Tracy
-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of John
Weller
Sent: Friday, August 16, 2019 2:15 PM
To: [email protected]
Subject: Timing Issue
Hi
I have an app with a countdown timer to shut down. The code is as shown
below (white space removed):
LOCAL lcMessageText
DECLARE Sleep in Win32API ;
integer nMilliseconds
WITH ThisForm
.cmdCancel.enabled = .F.
.Countdown = Control.Countdown
IF .ShutdownFlag = .T.
lcMessageText = 'Shutting down in '
ELSE
lcMessageText = 'Closing the Membership system down in '
ENDIF
*&* This is the message that doesn't display
.lblTimer.Caption = lcMessageText + ALLTRIM(STR(.Countdown)) + ' seconds'
.Refresh
DO WHILE .Countdown > 0
Sleep(5000)
.Countdown = .Countdown - 5
.lblTimer.Caption = lcMessageText + ALLTRIM(STR(.Countdown)) + '
seconds'
.Refresh
ENDDO
*!* IF .ShutdownFlag = .T.
*!* RUN Shutdown.exe /s /f /t 10
*!* ENDIF
.Release
CLEAR EVENTS
ENDWITH
My problem is that the message before the DO WHILE loop doesn't display.
The code is in the Click event of a button. When I press the button nothing
appears to happen for about 20 seconds then the messages in the loop are
displayed. It then works as planned.
Is there any way I can force the system to display the message?
Thanks
John
John Weller
01380 723235
07976 393631
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message:
https://leafe.com/archives/byMID/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.