怎么在数据窗口中用左箭头实现shift+tab
问:各位大侠: 我想在PB中获得一个象foxpro那样的编辑环境,即按左箭头光标便移动到当前列的左边一列,按右箭头光标便移动到右边一列,请问有什么办法?特急!!!
答:声明函数:
定义用户事件keydown: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! then
keybd_event(VK_TAB,0,0,0) //按下tab
keybd_event(VK_TAB,0,2,0) //释放tab
return 1
end if
此题由摆渡人工作室站长ferryman回答
kukoc 再提供另一种解决方法(比较原始,但也能实现):
function boolean GetKeyboardState (ref char kbarray[256]) library "user32.dll"
function boolean SetKeyboardState (ref char kbarray[256]) library "user32.dll"
//脚本:用户事件keydown:pbm_dwnkey
char lc_kb[256]
if key = KeyLeftArrow! then
GetKeyboardState (lc_kb)
lc_kb[17] = Char (128)
SetKeyboardState (lc_kb)
Send (Handle (this), 256, 9, 0)
GetKeyboardState (lc_kb)
lc_kb[17] = Char (0)
SetKeyboardState (lc_kb)
end if
PB编程俱乐部 http://kjx.126.com