With most objects, you can trap the key strokes using user events.
For example, on a datawindow object,
you can create a user event using Event Id = pbm_dwnkey.
In this event, you'll find a parameter of type keycode.
This is a predefined enumerated data type with values such as KeyA!, KeyB!, etc.
But if you want to convert this value to a string,
you'll find your choices are limited.
It looks something like this :
choose case a_key
case keyA!
ls_string = "A"
case keyB!
ls_string = "B"
case keyC!
ls_string = "C"
...
end choose
As simple as that!
Cheers..
Showing posts with label press. Show all posts
Showing posts with label press. Show all posts
Jan 15, 2012
Sending Key Press
You can make a control likely pressing (a) key(s).
First declare the Win32 API modul on Declare > Local External Functions
Subroutine keybd_event( int bVk, int bScan, int dwFlags, int dwExtraInfo) Library "user32.dll"
integer li_vkey
li_vkey = 65 // Character A
sle_1.setfocus() // the desired control to view
keybd_event( li_vkey, 1, 0, 0)
//Another example to simulate "Backspace" key
integer li_vkey
integer li_pos
li_pos = len(sle_1.Text) + 1
sle_1.selectText(li_pos, 0)// Cursor position on last text
li_vkey = asc ("~b") // backspace
keybd_event( li_vkey, 1, 0, 0)
It 100% works.
Cheers..
Subscribe to:
Posts (Atom)
Are legacy 4GL applications keeping you from embracing modern technologies?
As the competitive advantages offered by cloud, mobile, and other new technologies become more apparent, the decision to migrate legacy 4GL ...