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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can i clear lastkey() ?

Status
Not open for further replies.

andreateh

Programmer
Jul 19, 2003
83
SG
Code:
WAIT WINDOW LASTKEY()
WAIT WINDOW LASTKEY() TIMEOUT 2
CLEAR TYPEAHEAD 
WAIT WINDOW LASTKEY()

during excuting line 1 i press enter, so in line 2 i'll see a "13". But on line 4 i still see "13". Is it possible to clear the value in lastkey() ?
 
maybe you could use KEYBOARD CLEAR. haven't tried it tho but worht a shot.

kilroy [trooper]
philippines
"and that's what we call creativity..."
 
No you can't as far as I know.

Try assigning the value to another variable and then
testing whether the lastkey() and the assigned variable
are the same.

Darrell

i.e.
[tt]
clear
local nLastKey
WAIT WINDOW
nLastkey = LASTKEY()
? nLastKey,lastkey()

WAIT WINDOW TIMEOUT 2
nLastkey = LASTKEY()
? nLastKey==lastkey() && Was last key the same

CLEAR TYPEAHEAD

WAIT WINDOW
nLastkey = LASTKEY()
? nLastKey,lastkey()
[/tt]
 
oops!

Should be:

[tt]
clear
local nLastKey
WAIT WINDOW
nLastkey = LASTKEY()
? nLastKey,lastkey()

WAIT WINDOW TIMEOUT 2
? nLastKey==lastkey() && Was last key the same

CLEAR TYPEAHEAD

WAIT WINDOW
nLastkey = LASTKEY()
? nLastKey,lastkey()
[/tt]
 
To clear lastkey() - for instance to get rid of an 'escape' that might prevent a report loop from running I do this:

Code:
clear typeahead
keyboard chr(13)
inkey()

do while .not. eof() .and. lastkey() <> 27
  inkey()
  ...
  do something
  ...
  skip
enddo

Regards

Griff
Keep [Smile]ing
 
Thanks GriffMG. After a night of brain storm. I found the same solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top