1

I would like to use TActions to centralize the main choices of an application, but instead of defining individual OnExecute events to run each option, I was thinking of using a class factory on the general TActionList.OnExecute, so that general event will create and run the individual classes for each user option.

The problem is that Delphi disables the menu options with Actions without OnExecute events. So my question is if it's possible to disable that behaviour, so the menu options remain active even when their Action doesn't have any OnExecute event, letting the TActionList.OnExecute or similar to catch and treat that choice in a generic way (through a class factory).

If not then I will apply the same mechanism directly over the MainMenu items, but I would prefer to use TActions so it will also serve for ToolBars, etc. ...

Thank you.

Marc Guillot
  • 6,090
  • 1
  • 15
  • 42

1 Answers1

3

TAction offers a public property DisableIfNoHandler, which defaults to True. If you set it to False at runtime you should achieve your goal.

Uwe Raabe
  • 45,288
  • 3
  • 82
  • 130