我搜了很多资料,基本上都可以实现用enter键来完成tab键的功能,但是当遇到多行编辑框的时候,焦点就无法再继续跳转了,现在我用的方法是:SUBROUTINE keybd_event(UInt bVk,UInt bScan,Long dwFlags,Long dwExtraInfo ) LIBRARY 'user32.dll'
GraphicObject which_control
which_control = GetFocus()
CHOOSE CASE TypeOf(which_control)
CASE CommandButton!
which_control.TriggerEvent(Clicked!)
CASE SingleLineEdit!
IF Key = KeyEnter! THEN
keybd_event ( 9, 0, 0 , 0 ) // 按下tab
keybd_event ( 9, 0, 2, 0 ) // 释放tab
END IF
END CHOOSE
RETURN 1
包括最土的方法,if keydown(keyenter!) then
string ls_name
ls_name = classname(getfocus())
choose case ls_name
case 'sle_code'
mle_content.setfocus()
case 'mle_content'
sle_1.setfocus()
return true
end choose
end if
都无法让多行编辑框实现焦点的转移,请高手指点!
------解决方案--------------------
一楼的方法可用的,是你自己写错了,多行文本框是 case multilineedit!
1、将以下内容复制保存为到文本文档中,然后将文件名改名为:uo_multilineedit.sru
然后将该文件import到pbl中
- C/C++ code
$PBExportHeader$uo_multilineedit.sru forward global type uo_multilineedit from multilineedit end type end forward global type uo_multilineedit from multilineedit integer width = 549 integer height = 452 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 string text = "none" borderstyle borderstyle = stylelowered! event type integer post_key ( keycode key, integer keyflags ) event keydown pbm_keydown end type global uo_multilineedit uo_multilineedit type prototypes SUBROUTINE keybd_event(UInt bVk,UInt bScan,Long dwFlags,Long dwExtraInfo ) LIBRARY 'user32.dll' end prototypes event type integer post_key(keycode key, integer keyflags);//GraphicObject which_control //which_control = GetFocus() //CHOOSE CASE TypeOf(which_control) // CASE CommandButton! // which_control.TriggerEvent(Clicked!) // CASE MultiLineEdit! IF Key = KeyEnter! THEN keybd_event ( 8, 0, 0, 0 ) // 退格 keybd_event ( 9, 0, 0, 0 ) // 按下tab keybd_event ( 9, 0, 2, 0 ) // 释放tab END IF //END CHOOSE RETURN 1 end event event keydown;post event post_key(key, keyflags) end event on uo_multilineedit.create end on on uo_multilineedit.destroy end on
------解决方案--------------------
2、将以下内容复制保存为到文本文档中,然后将文件名改名为:ww.srw
然后将该文件import到pbl中
- C/C++ code
$PBExportHeader$ww.srw forward global type ww from window end type type mle_3 from uo_multilineedit within ww end type type mle_2 from uo_multilineedit within ww end type type mle_1 from uo_multilineedit within ww end type end forward global type ww from window integer width = 2295 integer height = 824 boolean titlebar = true string title = "Untitled" boolean controlmenu = true boolean minbox = true boolean maxbox = true boolean resizable = true long backcolor = 67108864 string icon = "AppIcon!" boolean center = true mle_3 mle_3 mle_2 mle_2 mle_1 mle_1 end type global ww ww on ww.create this.mle_3=create mle_3 this.mle_2=create mle_2 this.mle_1=create mle_1 this.Control[]={this.mle_3,& this.mle_2,& this.mle_1} end on on ww.destroy destroy(this.mle_3) destroy(this.mle_2) destroy(this.mle_1) end on type mle_3 from uo_multilineedit within ww integer x = 1509 integer y = 116 integer taborder = 30 end type type mle_2 from uo_multilineedit within ww integer x = 759 integer y = 104 integer taborder = 20 end type type mle_1 from uo_multilineedit within ww integer x = 64 integer y = 100 integer taborder = 10 end type
------解决方案--------------------
1、如何创建自定义的标准控件
在pb中,菜单“File → New”
在New窗口中,切换到PB Object标签页
选择Standard Visual,然后单击【OK】按钮
在Select Standard Visual...窗口中,选中multilineedit,然后单击【OK】按钮