Tracy, that command is "DOEVENTS" (no spaces)
Fred
On Fri, Aug 16, 2019 at 11:40 AM Tracy Pearson tracy@powerchurch.com wrote:
You need to force the events before the sleep starts with the
DO EVENTSHTH, Tracy
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of John Weller Sent: Friday, August 16, 2019 2:15 PM To: profoxtech@leafe.com 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 EVENTSENDWITH
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]