Ability to setup hotkeys....


Author
Message
StarkMike
StarkMike
StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Is there a way that I could setup a hotkey so that when a user presses ALT-N? Like a hotkey I could bind to the New button on the MaintenanceToolstrip?
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
The easiest thing to do here is to override the ProcessCmd method and insert your override logic.  This is something that we commonly do to add hotkey functionality...and this is the root level so it will trump anything else.

This is a method on any control, so you could either inherit the MaintenanceFormToolstrip and add it there...or if this is more of a one time thing then you could just do it in the form.  In either case, the code would be the same:

Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
Select Case keyData
    Case Keys.Alt Or Keys.N
 '-- It is always a good idea to supply a result in the message
        msg.Result = IntPtr.Zero
 
 '-- Perform your logic
        ' TODO

 '-- Return out of the method
        Return True

End Select

'-- Perform the default logic here
Return MyBase.ProcessCmdKey(msg, keyData)
End Function


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search