This is a migrated thread and some comments may be shown as answers.

Keyboard Shortcut for CommandBarButton

4 Answers 254 Views
CommandBar
This is a migrated thread and some comments may be shown as answers.
Jerves
Top achievements
Rank 1
Jerves asked on 29 Jun 2011, 05:33 PM
Hi,

I want a CommandBarButton click to occur when I press, say ctrl+H or alt+H.
How do I do this?
I tried setting the KeyTip property of the button to "H" but that did not work.

Thanks!

4 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 04 Jul 2011, 03:52 PM
Hello Jerves,

Thank you for your question.

You can achieve this by using our shortcut mechanism. The following code snippet demonstrates how this could be done:
this.commandBarButton1.Shortcuts.Add(new Telerik.WinControls.RadShortcut(Keys.Control, Keys.H));

This will fire the Click event of commandBarButton1 when Ctrl+H is pressed.

I hope you find this helpful. Should you have any additional questions, do not hesitate to ask.

Kind regards,
Ivan Todorov
the Telerik team
Registration for Q2 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting July 18th and book your seat for a walk through all the exciting stuff we ship with the new release!
0
ricric
Top achievements
Rank 1
answered on 21 Jul 2011, 05:29 PM
where should i put the shortcut code?
0
Ivan Todorov
Telerik team
answered on 26 Jul 2011, 03:09 PM
Hello Ricric,

You can put the code in your form's constructor or in the Load event handler. In general, you can put this code wherever you want. Once it has been executed, the shortcut will become functional.

Hope this helps.

Greetings,
Ivan Todorov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
ricric
Top achievements
Rank 1
answered on 26 Jul 2011, 03:59 PM
thanks.
Tags
CommandBar
Asked by
Jerves
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
ricric
Top achievements
Rank 1
Share this question
or