我在一个窗体上新建了一个ControlBar
然后在上面放了一个ToolBar
ToolBar上放了ToolButton
窗体上放了一个Menu
Menu上有快捷键
运行,快捷键可用
然后将窗体与菜单关联去掉,将ToolButton与Menu相关联
结果快捷键不可用了应当如何解决?
谢谢

解决方案 »

  1.   

    object ActionList1: TActionList
      Left = 184
      Top = 144
      object ActionHello: TAction
        Caption = 'ActionHello'
        ShortCut = 8304
        OnExecute = ActionHelloExecute
      end
    endobject MenuItem1: TMenuItem
      Action = ActionHello
    end-----------------------
    procedure TForm1.ActionHelloExecute(Sender: TObject);
    begin
      ShowMessage('你好');
    end;要养成使用Action的习惯!~~
      

  2.   

    object ActionList1: TActionList
      Left = 184
      Top = 144
      object ActionHello: TAction
        Caption = 'ActionHello'
        ShortCut = 8304
        OnExecute = ActionHelloExecute
      end
    endobject MenuItem1: TMenuItem
      Action = ActionHello
    end-----------------------
    procedure TForm1.ActionHelloExecute(Sender: TObject);
    begin
      ShowMessage('你好');
    end;要养成使用Action的习惯!~~
      

  3.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, Menus, ActnList;type
      TForm1 = class(TForm)
        ActionList1: TActionList;
        ActionHello: TAction;
        PopupMenu1: TPopupMenu;
        ActionHello1: TMenuItem;
        procedure ActionHelloExecute(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.ActionHelloExecute(Sender: TObject);
    begin
      ShowMessage('你好');
    end;end.//将如下代码复制到你的窗体上!~~object ActionList1: TActionList
      Left = 184
      Top = 144
      object ActionHello: TAction
        Caption = 'ActionHello'
        ShortCut = 8304
        OnExecute = ActionHelloExecute
      end
    end
    object PopupMenu1: TPopupMenu
      Left = 160
      Top = 48
      object ActionHello1: TMenuItem
        Action = ActionHello
      end
    end