Keyboard Shortcut for CommandBarButton

5 posts, 0 answers
  1. Jerves
    Jerves avatar
    3 posts
    Member since:
    Dec 2010

    Posted 29 Jun 2011 Link to this post

    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!
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 04 Jul 2011 Link to this post

    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!
  3. UI for WinForms is Visual Studio 2017 Ready
  4. ricric
    ricric avatar
    12 posts
    Member since:
    Sep 2010

    Posted 21 Jul 2011 Link to this post

    where should i put the shortcut code?
  5. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 26 Jul 2011 Link to this post

    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!

  6. ricric
    ricric avatar
    12 posts
    Member since:
    Sep 2010

    Posted 26 Jul 2011 Link to this post

    thanks.
Back to Top
UI for WinForms is Visual Studio 2017 Ready