Which way is the "correct" one to define a shortcut in Delphi?

Viewed 912

There are many examples on how to define a ShortCut in a Delphi program, but they boil down to just two different ways:

  1. Add any of the scCtrl, scShift and scAlt constants to Ord() of the key
  2. Use the Menus.ShortCut function

e.g.

Action.ShortCut := scCtrl + scShift + Ord('K');
// vs
Action.ShortCut := Menus.ShortCut(Word('K'), [ssCtrl, ssShift]);

Is one of these two ways preferable? If yes, which one and why?

2 Answers
Related