Jerry Dodge
Jerry Dodge

Reputation: 27276

How to get a shortcut string from TShortCut in an action?

I'm using a TActionManager, where each action has a keyboard ShortCut assigned to it. I would like to display text which represents the keyboard shortcut to the user. For example, F4 or Ctrl+F or Ctrl+Shift+S. However, the TShortCut is defined as:

type
  TShortCut = Low(Word)..High(Word);

How can I obtain a user-readable string which represents the shortcut assigned to an action?

Upvotes: 3

Views: 3147

Answers (1)

Jerry Dodge
Jerry Dodge

Reputation: 27276

I'm answering my own question Q/A style.

There's a built-in function for this called ShortCutToText() which converts any given TShortCut into a readable representation. On the other hand, there's also TextToShortCut() which works the other way around, converting any string into a TShortCut, given it's a valid shortcut value.

Upvotes: 6

Related Questions