TMenuItem not enabled when subclassing TForm


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
It can be illustrated with the following metacode:

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

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


constructor TfrmCustomMDI.Create(AOwner: TComponent);

procedure Loaded;
// Do nothing


Sent via
Share what you know. Learn what you don't.