已知:procedure TMainForm.helpfileClick(Sender:TObject);请问F1如何与之绑定???达到按F1调用helpfileClick???

解决方案 »

  1.   

    procedure Tform1.FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      if Key = VK_F1 then ...
    end;
      

  2.   

    消息
    procedure WMHotKey(var Msg: TWMHotKey); message WM_HOTKEY;procedure TMainForm.WMHotKey(var Msg: TWMHotKey);
    begin    if msg.HotKey=gKeyID then        //热键F1的消息.
          helpfileClick;
     end;procedure TMainForm.FormCreate(Sender: TObject);
    var
      tmp               : Integer;
    begin
      //注册系统级热键
      tmp := GlobalFindAtom('我的程序');
      if tmp = 0 then
        gKeyID := GlobalAddAtom('我的程序')
      else
        gKeyID := tmp;
      RegisterHotKey(Handle, gKeyId, 0, VK_F1) then  //F1
    end;
      

  3.   

    建议楼主使用ActionList,加入一个Action,并定义ShortCut为F1,把Action的Execute事件方法指定为TMainForm.helpfileClick,就可以了
      

  4.   

    请问ActionList在哪个属性页中了