Link to home
Start Free TrialLog in
Avatar of TonyDelphiHunt
TonyDelphiHuntFlag for Afghanistan

asked on

Disable Main Menu

I would like to disable the main menu during some operations and as there is not an 'Enabled' property, I feel I must be missing a simple trick.

PLEASE spare my blushes for the simplest 125 points I've ever given...

Tony
Avatar of Pierre Cornelius
Pierre Cornelius
Flag of South Africa image

Hello TonyDelphiHunt,

You must do it at TMenuItem level e.g.

procedure TForm1.Button1Click(Sender: TObject);
var i: integer;
begin
  for i:= 0 to MainMenu1.Items.Count-1
    do MainMenu1.Items[i].Enabled:= false;
end;

Regards,

PierreC
Avatar of TonyDelphiHunt

ASKER

Ahhhhhhhhhhhhh. I see. The trouble is, I already have a lot disabled so I guess I'll just have to save the states in an array or similar, unless there's a better way?
ASKER CERTIFIED SOLUTION
Avatar of developmentguru
developmentguru
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent suggestion developmentguru:.Good Lateral thinking. I can then point all the MainMenu2 items to one procedure  saying "Finish editing XXXXX first" or similar.

Thank you too PierreC. I'll store that in what remains of my brain for future use.