線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1188
推到 Plurk!
推到 Facebook!

KeyDown 問題

答題得分者是:hagar
carter6
初階會員


發表:53
回覆:108
積分:42
註冊:2002-12-16

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-12-16 15:55:53 IP:61.59.xxx.xxx 未訂閱
不好意思問這種問題~~~ 其它鍵讀的到 為什麼就是 TAB 不行呢?? procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = VK_TAB then begin Button1Click(Sender); end; end;
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-12-16 16:22:02 IP:202.39.xxx.xxx 未訂閱
參考: How to catch a 'Tab Character' key stroke inside  your TEdit control. - by Borland Developer Support Staff     Abstract:      Question: How can I catch the tab character inside of my  Edit controls?      Answer: This can easily be done by overriding the forms  CMDialogKey procedure. To see how this works drop a Edit  on the form and enter in the following code:     
procedure TMyForm.CMDialogKey(Var Msg: TWMKEY);
begin
  if (ActiveControl = Edit1) and (Msg.Charcode = VK_TAB) then
  begin
   ShowMessage('Somebody Tabbed?');
  end;
  inherited;
end;
Also, make sure to add the following line to your forms definition:
    procedure CMDialogKey(Var Msg: TWMKey); message CM_DIALOGKEY;
-- Everything I say is a lie.
系統時間:2024-06-26 8:31:43
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!