System.Actions.TContainedAction.DisableIfNoHandler

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property DisableIfNoHandler: Boolean read FDisableIfNoHandler write FDisableIfNoHandler  default True;

C++

__property bool DisableIfNoHandler = {read=FDisableIfNoHandler, write=FDisableIfNoHandler, default=1};

Properties

Type Visibility Source Unit Parent
property public
System.Actions.pas
System.Actions.hpp
System.Actions TContainedAction

Description

Indicates whether the action's clients should be disabled if no OnExecute event handler is found.

DisableIfNoHandler defines whether to set the Enabled property of the action to False if no OnExecute event handler is set for the action. Setting Enabled to False disables all the action's clients.

See, for example, how FMX.Forms.TApplication.UpdateAction uses DisableIfNoHandler to define whether to set Enabled to False if the OnExecute event handler is not defined to the action.

For example, setting DisableIfNoHandler to False can be useful when managing submenus. In this case, pointing to a command on the main menu, which causes the submenu to open, does not need any OnExecute event handler. Then, if DisableIfNoHandler is True, this main menu command becomes disabled and the submenu cannot be opened. In such cases it can be convenient to use actions of types FMX.Controls.TControlAction and Vcl.Controls.TControlAction. Objects of these classes have the value of DisableIfNoHandler set to False, by default.

See Also