Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delay to read messages

Status
Not open for further replies.

Bryan - Gendev

Programmer
Jan 9, 2011
408
AU
I have a multisection process in which I wish to write the result of each process to a label on my form.

At the end of each process I have the following lines of code

Code:
frmglobals2.text1.value  = cMessage
DECLARE Sleep IN kernel32 INTEGER dwMilliseconds
sleep(ndelay)

I have an options form also to allow the selection of the ndelay public variable (1000 - 5000) which is also written to the ini file.

I do not seem to get proportional delays when I test these values.

Am I using the wrong method for the delay?

Thanks

GenDev

 
Add 10000 to your interval. 1000 milliseconds really isn't noticeably different from 5000 milliseconds, both being well shorter than one full second.

When it comes to video updates you're completely at the mercy of the Windows video subsystems and your video drivers. You do not, will not, and can not have precise control.

Having said that, instead of going outside of VFP to refresh video, you can often force a refresh with:

READ VALID .T. TIMEOUT .01

(the timeout value is in seconds)

This may improve your video refresh but it will MASSIVELY slow down your application, which is why the other way doesn't refresh as often in the first place. ;-)
 
Dan, no 1000 milliseconds is a second, not 10000.

But, GenDev, what do you expect? You set a textbox value, which can be displayed instantly, then you wait.

What comes afterwards?

Bye, Olaf.
 
The delay value is chosen from a drop down on the options form and written to the ini.
A read of the ini file fills a public variable nDelay

After each process the Sleep(nDelay) command is run.

There are 6 steps in the process which count certain things. I report these values to the screen and the delay is to allow the user time to read them.

GenDev
 
Ah,

so should try to do frmglobals2.text1.refresh() after setting the value and DOEVENTS FORCE before going to Sleep() to refresh the display before you wait and continue. Also, why not use an editobox and display a scrolling log? Simple set SelStart to Len(.value) of an editbox. refresh() also applies, but there is no reason to wait then, before continuing processing.

Bye, Olaf.
 
Olaf,

Thanks for that idea which I like.

I haven't coded a scrolling log before.

I have implemented it but the line of text in the editbox is ovewritten by the new text of the next process

I have myedit1.selstart.value = 400 ( width of box)

Is there something I have missed?

GenDev
 
Yes, Mike has answered that good.

Of course you need to concatenate new text to the old one, setting value to a new message overwrites the old one, what do you expect?

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top