首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

在grid型DW中,enter键处理的函数

2012-03-02 
求一个在grid型DW中,enter键处理的函数我自己处理的一个,以前用的时候感觉没问题,现在用的时候,回车时老是

求一个在grid型DW中,enter键处理的函数
我自己处理的一个,以前用的时候感觉没问题,
现在用的时候,回车时老是跳行。

求一个grid型,tab转enter的函数。
谢谢

[解决办法]

C# code
if key = KeyEnter! then    if Not IsNull(is_savecolname) then  // is_savecolname跳到他就新增的欄位,可直接寫入你自己的欄位           if this.GetColumnName() = is_savecolname then            this.insertrow(0)            this.setfocus()            this.setrow(this.rowcount())            this.post setcolumn('upper_code')//upper_code 新增行得到焦點的欄位        else            Send(Handle(this),256,9,0)            return 1        end if    end if    return 1end ifReturn 0
[解决办法]
建议用PFC里的东东吧,以下是步聚:
1、先启用PFC相关的服务

//启用行管理服务及连接数据库并检索
this.of_SetRowSelect(TRUE)
this.of_SetRowManager(TRUE)
this.inv_rowselect.of_SetStyle(this.inv_rowselect.EXTENDED)

this.of_SetTransObject(SQLCA)

long ll_return
ll_return = this.of_Retrieve()

2、再自定义一个事件ue_keydown

int VK_TAB = 09
int 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
if this.AcceptText() < 0 then
return 1
end if

if this.GetColumn() = Long(this.object.datawindow.column.count) then
if this.GetRow() = this.RowCount() then
this.InsertRow(0)
this.ScrollToRow(this.GetRow() + 1)
this.SetColumn(1)
return 1
end if
end if

keybd_event(VK_TAB,0,0,0)
keybd_event(VK_TAB,0,2,0)
return 1
end if

热点排行