眾所周知,回車鍵一般情況下都適用于確認(rèn),那么,在應(yīng)用程序中用好回車鍵也是很有必要的。 1.回車鍵在window中的應(yīng)用 比如一個登錄窗口w_login,當(dāng)用戶輸入用戶名,按下回車鍵后,即可進(jìn)入密碼的輸入,密碼輸入結(jié)束后,按下回車鍵焦點(diǎn)移動到一下操作,依次類推,那么我們就應(yīng)該這樣用代碼來控制: 首先,假設(shè)w_login窗口中有:sle_username、sle_password、cb_ok和cb_cancel等控件。 a.在sle_username的modify事件中寫如下代碼: // script for user event ue_checkkey, // which is mapped to pbm_keydown. if keydown(keyenter!) then // go to sle_3 if sle_2.setfocus( ) // enter pressed. end if
b.在sle_password的modify事件中寫如下代碼: // script for user event ue_checkkey, // which is mapped to pbm_keydown. if keydown(keyenter!) then // go to sle_3 if cb_ok.setfocus( ) // enter pressed. end if 注意:這里不提倡使用按鈕的default屬性,否則,按下回車鍵后響應(yīng)了按鈕的defaule屬性。
if this.getcolumn()=long(this.describe("datawindow.column.count")) then if this.getrow()=this.rowcount() then this.insertrow(0) this.scrolltorow(this.getrow()+1) this.setcolumn(1) return end if end if send(handle(this),256,9,long(0,0)) this.settransobject(sqlca)