We help IT Professionals succeed at work.

Delphi: how to implement a User Shortcut mapper?

Member_2_7965240 used Ask the Experts™

I have different shortcuts in my program but I want to let the users change the shortcuts, just like in Notepad++ Shortcut mapper.

I like help in following:

- How to implement this in Delphi easily (attaching shortcuts to buttons and actions)
- Directions what is the best method to save and load the users shortcuts in/from database (each user of the same program would have separate shortcut settings).

Thank you in advance.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software architect
Top Expert 2012
Create/add TAction for each procedure which you have to TActionList. You can do this in design time.
You can show this list to user in run time with shortcut combination.
Clear shortcut for TAction: acMyCopy.ShortCut:=scNone
Set new shortcut: acMyCopy.ShortCut:=ShortCut(Ord('C'), [ssCtrl])
To temporary disable action (to not fire when setting new shortcut): acMyCopy.Enable:=False
Put in your database - character (like 'C') and one byte where a one bit is associate with ssCtrl,ssShift,ssAlt
hope this helps...