The TActionMainMenuBar main menu item switch stutters in Delphi 7

I use a TActionToolBar with a TActionMainMenuBar in a Delphi 7 project. When I'm browsing one main menu and I want to change to one another (4ex file to edit) I have to click twice on the another menu item for the change (1., close the first, 2., open the new sub menu). With TMainMenu this is seamless, enough just move over the another menu item, the submenu changes automatically. What messages should I override, or what api calls should I make to realize a TMainMenu like behaviour? There must be a solution because the Delphi 7 IDE uses the same component and its behaviour is right.

The date of the dclact70.bpl : 10.08.2002 (dd.mm.yyyy)

The Unit1.pas:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ActnList, XPStyleActnCtrls, ActnMan, ToolWin, ActnCtrls,
  ActnMenus;

type
  TForm1 = class(TForm)
    ActionMainMenuBar1: TActionMainMenuBar;
    ActionManager1: TActionManager;
    Action1: TAction;
    Action1_1: TAction;
    Action1_2: TAction;
    Action2: TAction;
    Action2_1: TAction;
    Action2_2: TAction;
    procedure emptyActionHandler(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.emptyActionHandler(Sender: TObject);
begin
//
end;

end.

The unit1.dfm:

object Form1: TForm1
  Left = 584
  Top = 180
  Width = 870
  Height = 640
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object ActionMainMenuBar1: TActionMainMenuBar
    Left = 0
    Top = 0
    Width = 854
    Height = 29
    ActionManager = ActionManager1
    Caption = 'ActionMainMenuBar1'
    ColorMap.HighlightColor = clWhite
    ColorMap.BtnSelectedColor = clBtnFace
    ColorMap.UnusedColor = clWhite
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clMenuText
    Font.Height = -12
    Font.Name = 'Segoe UI'
    Font.Style = []
    Spacing = 0
  end
  object ActionManager1: TActionManager
    ActionBars = <
      item
        Items = <
          item
            Items = <
              item
                Action = Action1_1
                Caption = '&Action1_1'
              end
              item
                Action = Action1_2
                Caption = 'A&ction1_2'
              end>
            Action = Action1
            Caption = '&Action1'
          end
          item
            Items = <
              item
                Action = Action2_1
              end
              item
                Action = Action2_2
              end>
            Action = Action2
            Caption = 'A&ction2'
          end>
        ActionBar = ActionMainMenuBar1
      end
      item
        Items = <
          item
            Action = Action2_1
          end
          item
            Action = Action2_2
          end>
      end>
    Left = 8
    Top = 40
    StyleName = 'XP Style'
    object Action1: TAction
      Caption = 'Action1'
      OnExecute = emptyActionHandler
    end
    object Action1_1: TAction
      Category = 'ac1'
      Caption = 'Action1_1'
      OnExecute = emptyActionHandler
    end
    object Action1_2: TAction
      Category = 'ac1'
      Caption = 'Action1_2'
      OnExecute = emptyActionHandler
    end
    object Action2: TAction
      Caption = 'Action2'
      OnExecute = emptyActionHandler
    end
    object Action2_1: TAction
      Category = 'ac2'
      Caption = 'Action2_1'
      OnExecute = emptyActionHandler
    end
    object Action2_2: TAction
      Category = 'ac2'
      Caption = 'Action2_2'
      OnExecute = emptyActionHandler
    end
  end
end
链接地址: http://www.djcxy.com/p/91082.html

上一篇: 如何在任何时候停止使用SAX解析xml文档?

下一篇: Delphi 7中的TActionMainMenuBar主菜单项切换结尾