tags:

views:

91

answers:

2

Hi,

I want to design a shortcut keys framework. Such as Alt + CA, Alt + CI such that the second shortcut key option is a combination of multiple characters. Is there any way to achieve this.

Regards, Harsh Suman

A: 

This is possible -

You'll need to have a way to add an event handler to track multiple key down or key press events. You won't be able to just treat it as a single key down, and you'll need to save the state between key events.

The biggest difficulty I see will be in determining when a key event was an old key combo, or starting a new one. (What happens when the user press Alt+CDE and Alt+DE is a "combo"?) This becomes easier to manage if you require that your combinations are always modifer + one or modifier + two keystrokes, but if you want it completely generic, it may be more difficult.

Reed Copsey
A: 

If you are using WPF you can use the KeyBinding class: http://msdn.microsoft.com/en-us/library/system.windows.input.keybinding.aspx

Richard Hein