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

ShortcutKeys

5 Answers 125 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Juan Pablo
Top achievements
Rank 1
Juan Pablo asked on 06 Jan 2009, 04:58 PM
Hello!

When I use the default menu in a Windows Form application I can do something like this:
            this.myToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));

Is there any way to do something like that with your menu controls?

Thaks in advance for your help.

5 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 07 Jan 2009, 03:47 PM
Hi Juan Pablo,

Thank you for the question.

Yes, you can assign key chords on our RadMenuItems as well. However, the programmatic approach is a bit different. Please refer to the following code snippet:
ChordModifier chordModifier = new ChordModifier();  
chordModifier.ControlModifier = true;  
Chord chord = new Chord();  
chord.ChordModifier = chordModifier;  
chord.Keys = "Ctrl+Q";  
ClickCommand activateMenuItemCommand = new ClickCommand();  
InputBinding inputBinding = new InputBinding(activateMenuItemCommand, chord, this.radMenuItem1);  
this.radMenu1.CommandBindings.Add(inputBinding); 

The above snippet will 'Click' RadMenuItem1, if you key press Ctrl+Q.

However, if RadMenuItem is a main menu item and you want to open its drop down menu, you will need the ActivateMenuItemCommand:
ChordModifier chordModifier2 = new ChordModifier();  
chordModifier2.ControlModifier = true;  
Chord chord2 = new Chord();  
chord2.ChordModifier = chordModifier2;  
chord2.Keys = "Ctrl+P";  
ActivateMenuItemCommand activateMenuItemCommand2 = new ActivateMenuItemCommand();  
InputBinding inputBinding2 = new InputBinding(activateMenuItemCommand2, chord2, this.radMenuItem1);  
this.radMenu1.CommandBindings.Add(inputBinding2); 

You can easily assign key chords using the designer. Just select RadMenuItem1 and in the Visual Studio property grid, navigate to CommandBinding property.

I hope this helps. If you have additional questions, feel free to contact me.

Sincerely yours,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Eric
Top achievements
Rank 1
answered on 13 Oct 2009, 02:15 PM
Hi,
I have the latest Winforms revision and even with the previous one I had and still have the following issue:

I am using a RibbonBar, when I try to select the property CommandBinding on a radMenuItem or a radButtonElement, I have an error (see attached screen capture).

I would like to be able to set keys via Designer instead of using code.

Any work around? or fix?
0
Nikolay
Telerik team
answered on 16 Oct 2009, 01:55 PM
Hi Eric,

Thank you for the question.

We believe that you have already addressed the issue that you experience in our latest Internal Build 2009.2.9.903. Please download it and give it a try. If you continue experiencing the described behavior, please provide us with the exact steps that lead you to the error message.

Greetings,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Eric
Top achievements
Rank 1
answered on 19 Oct 2009, 03:32 PM
Hi Nikolay,
I did install the version 2009.2.9.903 using the RadControls_for_WinForms_2009_2_9_903_dev.zip and it fix my issue with CommandBindings property!

For your information, the file RadControlsForWinForms.exe in your latest Internal Builds is not the version 2009.2.9.903 but 2009.2.9.8xx version that was not fixing my issue with Command Bindings. I tried this one first...

Eric
0
Nikolay
Telerik team
answered on 28 Oct 2009, 08:00 AM
Hello Eric,

Thank you for your feedback.

We decided to keep the history of the internal builds. This is why you have found both 2009.2.9.903 and 2009.2.9.804 internal builds with their respective release notes. This allows you to review the main issues addressed in every build. However, I think understand your point of view. We will consider including the version number in the file name of the installers, but not only in the file name of the archive files.

Kind regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Menu
Asked by
Juan Pablo
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Eric
Top achievements
Rank 1
Share this question
or