hi
i have made a OSK CLASS with Xbase++ but i guess Problem are same.
to type into "own" OSK it must have Focus and it must know which Control send Keystoke to ...
guess you have a Form an 3 x "Edit" so if you begin to type into OSK you want to have Keystoke in 1st "Edit"
now press "TAB" to change to next "Edit" and give "own" OSK Focus again to press next Key ...
when press a Key most is to send "as it is" but if you want Combination like Shift-Ctrl-Alt ...
Code: Select all | Expand
METHOD DXE_KbWin:SendKey( cKeys, lShift, lCtrl, lAlt, lAltGR )
LOCAL i := 0
LOCAL nCode := 0
DEFAULT lShift TO .F.
DEFAULT lCtrl TO .F.
DEFAULT lAlt TO .F.
DEFAULT lAltGR TO .F.
IF cKeys # NIL
::SetTheFocus() // App <-> OSK
IF VALTYPE( cKeys ) == "C"
// for each Key in String
FOR i := 1 TO LEN( cKeys )
// single key
nCode := GetVirtualKeyCode( cKeys[ i ], @lShift, @lCtrl, @lAlt, @lAltGR )
IF lShift
keybd_event( VK_SHIFT, 0, 0, 0 )
ENDIF
IF lCtrl
keybd_event( VK_CONTROL, 0, 0, 0 )
ENDIF
IF lAlt
keybd_event( VK_MENU, 0, 0, 0 )
ENDIF
IF lAltGR
keybd_event( VK_RMENU, 0, 0, 0 )
ENDIF
// now send "the" key
keybd_event( nCode, 0, 0, 0 )
keybd_event( nCode, 0, KEYEVENTF_KEYUP, 0 )
// clean up
IF lAltGR
keybd_event( VK_RMENU, 0, KEYEVENTF_KEYUP, 0 )
lAltGR := .F.
ENDIF
IF lAlt
keybd_event( VK_MENU, 0, KEYEVENTF_KEYUP, 0 )
lAlt := .F.
ENDIF
IF lCtrl
keybd_event( VK_CONTROL, 0, KEYEVENTF_KEYUP, 0 )
lCtrl := .F.
ENDIF
IF lShift
keybd_event( VK_SHIFT, 0, KEYEVENTF_KEYUP, 0 )
lShift := .F.
ENDIF
NEXT
ELSEIF VALTYPE( cKeys ) == "N" // NumPad ( hide/show )
...
Code: Select all | Expand
FUNCTION GetVirtualKeyCode( cChar, lShift, lCtrl, lAlt, lAltGR )
LOCAL nCode
LOCAL nHiByte
nCode := VkKeyScanA( ASC( cChar ) )
nHiByte := HiByte( nCode )
lShift := ( nHiByte = 1 )
lCtrl := ( nHiByte = 2 )
lAlt := ( nHiByte = 4 )
lAltGR := ( nHiByte = 6 )
RETURN LoByte( nCode )
DLLFUNCTION VkKeyScanA( cChar ) USING STDCALL FROM USER32.DLL
---
on a Table PC "own" OSK must change Position / Size when turn 90° from Landsacpe <-> Portrait
---
also Form must be resize able and "own" OSK must be "visible" to reach it
---
on my 310 Miix with 10" Full-HD i still have Problem with my (big) Finger to type into OSK
on a 22" HP All-in-One with Full-HD it is easy to hit right Key
so i use 310 Miix "real" Keyboard or Bluetooth "Laser Keyboard" when i need to "write"