Shortcut aid duplicate in Visual studio

2010-03-04

When developing Winforms (and Webforms and Aspnet) in Microsoft Visual Studio there is no aid to stop me from entering overlapping shortcuts.

For example I have a menu with 5 items which have shortcuts alt-F, alt-E, alt-V, alt-T and alt-H.  It is then important that my buttons don’t have the same shortcuts.  There is nothing in Visual Studio signalling a shortcut used in more than one place.

Technically this could be solved through recursing through the controls of a form.  It can be done in the OnLoad event and only in debug mode.  The controls could then be highlighted and maybe reported since it isn’t possible to statically change shortcut while debugging and at least I forget which two controls should be changed to what.
One could take it further to show up already in the designer, that would be the nicest solution.

It is more complex for MDI interfaces.  There is no static linking between a parent and child forms.  One could have a settings file describing the relations.

Ditto tab controls.

Then we have rules like that alt-S should be Save and alt-E should be used for Seek throughout the application.  Without thinking one could use alt-S for Seek in a form somewhere which could fool the user into believing he has saved when he have not.
The technical solution to this could be to have a common settings file.  Controls using one of the regulated short cuts then flag that they are approved for this by a flag.  A developer might accidentally set a short cut but not a flag at the same time.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: