TMenuItem not enabled when subclassing TForm

Hi!

I have created a form called TfrmBase. From this I
have inherited (using the repository) a form that I
call TfrmCustomMDI.
TfrmCustomMDI is a MDIForm containing a number of
component, including a TMainMenu that is used by
the form. The TMainMenu have a number of standard
menuitems in it that are all disabled.
I have inherited my applicationform (also using the
repository) from TfrmCustomMDI and called the new
class TfrmMDIApp.
Using the designer I enable on of the menuitems
(mnuNew for example) in my TfrmMDIApp form. In the
TMainMenu property editor the item is Enabled.
If I close the property editor and open the menu
in the form (still in the designer) the menu is
enabled. But if I run my application the menuitem
suddenly show up disabled. When I close the program
and return to the delphi designer the menuitem still
appears to be disabled. If I open the MainMenu property
editor, the menu is enabled there but still disabled
in the form. Wierd heh??? And I have no code whatsoever
in my program that does anything with the mainmenu or
any of the menuitems.
TfrmCustomMDI has an own constructor and an own loaded
method. This is for the loaded method to be run only
once when subclassing TForm twice. I have also tested
the same code without my own constructor and loaded method
and the strange results with the menuitem remains.
TfrmCustomMDI also contain a TToolButton programmed
with the same enabled properties as the menuitem.
The toolbutton works perfectly - it's enabled in
TfrmMDIApp.
It can be illustrated with the following metacode:

type
  TfrmCustomMDI = class(TForm)
    FormStyle = fsMDIForm;
    MainMenu: TMainMenu
      mnuEdit: TMenuItem
        mnuNew: TMenuItem;
          Enabled = False;
  public
    constructor Create(AOwner: TComponent); override;
    procedure Loaded; reintroduce; virtual;
  end;

  TfrmMDIApp = class(TfrmCustomMDI)
    inherited MainMenu: TMainMenu;
      inherited mnuEdit: TMenuItem;
        inherited mnuNew: TMenuItem;
          Enabled = True;
  end;

implementation

constructor TfrmCustomMDI.Create(AOwner: TComponent);
begin
  inherited;
  Loaded;
end;

procedure Loaded;
begin
// Do nothing
end;

‰

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.