Edit Menu shortcuts

From TOF
@JeffT asked

I wrote that for the IDE
It completely custom but the technique is pretty simple

  1. internally theres a list of EVERY possible menu item and its name (no menu item arrays are used)
    this is why you cant edit the short cut for each new window opened
  2. when the app opens it reads this list and sees what short cut the user has assigned and then hunts down those menu items & makes the short cut whatever was assigned
  3. when the user edits those settings and saves those changes the menu items are updated

If you use many menu bars it gets a tad more complex but you could write one method that in can be called when a window open (Note that changing menu short cuts in the enable menu items can mostly work its not perfectly reliable)


Since you got less than useful replies on TOF

Its not hard to implement this just grunt work
Biggest pain is that macOS has 4 modifiers you can use and Linux & Windows have 3 which constrains you quite a bit
I sat down & created a lits of every menu option in the app then listed which ones were used already
And I added a little checker that makes sure you dont assign the same one more than once

As well some are “reserved” by the OS (particularly on macOS) so they cant really be used by your app

Its a decent amount of work to make this possible - none of it really rocket science though