如何利用左右键及回车键来转移列的焦点?
请问如何实现利用左右键及回车键进行列的焦点转移?这要用到Windows中的API函数keybd_event()
①定义API:
Subroutine keybd_event(uint bVk,uint bScan,long dwFlags,long dwExtraInfo ) library "user32.dll"
②自定义一用户事件(ue_keydownID:pbm_dwnkey):
integer VK_TAB = 09
integer VK_SHIFT = 16
if key = KeyLeftArrow! then
keybd_event(VK_SHIFT,0,0,0) //按下shift
keybd_event(VK_TAB,0,0,0) //按下tab
keybd_event(VK_TAB,0,2,0) //释放tab
keybd_event(VK_SHIFT,0,2,0) //释放shift
return 1
end if
if key = KeyRightArrow! or key=KeyEnter! then
keybd_event(VK_TAB,0,0,0) //按下tab
keybd_event(VK_TAB,0,2,0) //释放tab
return 1
end if
如若只是想利用ENTER键来实现TAB键的功能可以用以下代码:
if key=keyenter! then
Send(Handle(this),256,9,Long(0,0)) //发送TAB键
Return 1//取消原ENTER键的动作
end if
页:
[1]