Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I...
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00389776
Message ID:
00390059
Views:
10
>>1) Make the cursor (focus) go to a certain field by means of pressing a key like F2, but only while I am in a given form?
>>I tried an ON KEY LABEL F2 thisform.thisfield.setfocus
>>but got a message saying thisform can only be used within a method.
>>
>>2) I have several combo boxes in a form and I'd like them to display (open) automatically when getting the focus. I'm looking for an equivalent SendKeys command in Visual Basic, but can't find any.
>>
>>Thanks in advance.
>>Ulises.
>ad1) How about _screen.activeform.specobject.setfocus()
>
>ad 2) at gotfoucus KEYBOARD '{ALT+DNARROW}'
>

You can use the Wscript.Shell COM object's SendKeys method, or use the Win32 API's SendMessage() to send WM_KEYDOWN and WM_KEYUP messages directed at the current window, or keybd_event() or SendInput() (requires 98 or NT SP3 or later) to send keystrokes. SendMessage() can also send mouse results, there's a separate API function mouse_event() equivalent to keybd_event().

There's a minor glitch with using KEYBOARD here, in that it adds to the end of the queue for the keyboard buffer. The result generally looks like a keyboard error. Issuin a KEYBOARD CLEAR, or sucking in the current buffer using CHRSAW() and INKEY(), and sending the added string before resending the current buffer are two options available here.

>
>Hopes this helps
>
>Lasse
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform