Send(Handle(this),256,9,Long(0,0))
This.SetActionCode(1)
这将把消息传递给Tab键,同时忽略Enter键的处理。下面是一段用数据窗接收数据的完整的程序段,其中采用了用Enter键替代Tab键的代码。当光标在每行最后一列时按Enter键,光标会移至下一行第一列;当光标在最后一行的最后一列时按Enter键,会自动产生新行并将光标置于该行的第一列;在其它情况下按Enter键,光标会移至当前行的下一列。这段程序仍然写在与pbm_dwn ProcessEnter相对应的用户事件Enterkeydown下:
IF This.AcceptText()<0 then
this.setactioncode(1) return
endif
if this.getcolumn()=Long(This.DwDescribe("datawindow.column.count")) then
if this.getrow()=This.RowCount() then
this.insertrow(0)
this.scrolltorow(this.getrow()+1)
this.setcolumn(1)
this.setactioncode(1)
return
endif
endif
send(handle(this),256,9,long(0,0))
this.setactioncode(1)