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)