Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to clear lastkey()?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Miscellaneous
Thread ID:
01522334
Message ID:
01522354
Views:
56
Hi John.

You'll want to be careful with that solution because a backspace will not always undo the effect of a space. For example, if a command button or checkbox see the space then backspace wont unclick them.

What I have done in the past was use the following which seems reasonably safe.
Keyboard " " Plain Clear
Inkey(0)

The only problem that this has is that if there are characters in the buffer then you will loose them. If that seems like something that might happen then you could create a program that uses ChrSaw() and InKey() to empty the buffer and record what's there, then Keyboard a space and what was there back in and then remove the space. Given that the code would have to replace all of the special values with the encoded strings and I only ever used this where there wasn't really any time for key to build up I never bothered trying this.

Ian Simcock.


>Got it:
if inlist(lastkey(),5,4,19,24,13,9,15) AND Thisform.HtmlLostFocusOff < 0
>  NODEFAULT
>  KEYBOARD ' '
>  KEYBOARD "{BACKSPACE}"
>endif
>
>
>>Sorry, that's the only I can think of.
>>
>>>Tore, I tried that then realized that clear typeahead clears out the keyboard buffer. In other words it clears out what's ahead. I need to change what's been done.
>>>
>>>>Clear Typeahead, as far I can remember.
>>>>
>>>>>The IE browser control is kinda funky to work with so you gotta get creative.
>>>>>
>>>>>I am trying to prevent the cursor from exiting an HTML Edit control with the keyboard. The only code that works reliably is:
>>>>>
if inlist(lastkey(),5,4,19,24,13,9,15)
>>>>>  NODEFAULT
>>>>>endif
>>>>>
>>>>>However, if the lastkey() was any of the above and I click on another object on the form the cursor stays in the HTML Editor .
>>>>>
>>>>>Is there command that will clear/change the value of last key besides one that would wind up in the HTML? I want to put it right under the NODEFAULT.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform