The Presentation framework calls HandleCanDo to determine whether to enable the menu item or not--if HandleCanDo returns True, the item is enabled. By default, HandleCanDo always returns True. The framework evaluates menu items to determine whether they should be enabled or disabled whenever the current selection changes.
For example, the menu items that cause a TChangeColorCommand to be issued against a TTilesSelection should only be enabled when the target selection is not empty (at least one tile is selected). In this step, TChangeColorCommand overrides HandleCanDo, returning the result of a call to the selection's IsEmpty function. This means that when no tiles are selected, HandleCanDo will return False and the Presentation framework won't enable the Red, Green, and Blue menu items.
Conversely, the items that allow the user to add a tile to the document should always be enabled, because the underlying command TCreateTileCommand only uses the target selection to access the model and doesn't modify any currently selected tiles. Hence, TCreateTileCommand doesn't need to override HandleCanDo.
Items that are disabled are displayed in grey, as shown in this figure:
NOTE
You can also control when a menu item can be undone and redone by overriding the functions HandleCanUndo and HandleCanRedo for the underlying command. HandleCanUndo and HandleCanRedo also return True by default when you construct the command with the UndoType enum
value kSerialUndo.