简体   繁体   中英

Allowing users to setup their own menu shortcuts

I was following a tutorial for setting up menu shortcut keys, and have figured out how to add them.
Now I'm thinking, well maybe ctrl+O is too tedious to display the openFile dialog. Or maybe the user is missing their ctrl keys (or never had any to begin with!)

So I want to add a dialog that allows users to customize the shortcut keys. It would likely involve a listview that grabs the list of all of the menubar options and a textbox for the actual shortcut they want to use.

  • Can this be done? I'm not sure if the shortcut keys can be modified dynamically.
  • Would I have to save the shortcut keys somewhere like in an external config file and change the way I am setting shortcut keys by reading from a file instead of setting it in the designer?

The shortcut keys can be set dynamically using the Shortcut Property . To do this, you would have to save the short cut keys to some kind of XML config file. When your application boots up, it should read in this XML file and then dynamically set the shortcut by setting the property that I linked you above!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM