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

Shortcut behaviour incorrect

5 Answers 107 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Blair
Top achievements
Rank 1
Blair asked on 07 Jun 2011, 12:20 AM
First as a prologue, I am aware of the deficiency that radmenus do not show the accelerator key all the time, despite the windows default having been set. To get around that, I have added code which I have found elsewhere in this forum, basically this:

Public Sub ShowMenuShortCuts(ByVal AMenuItems As Telerik.WinControls.RadItemOwnerCollection)
    Dim i As Int32 = 0
    While (i < AMenuItems.Count)
        Try
            CType(AMenuItems(i).Children(2).Children(0).Children(1).Children(0), Telerik.WinControls.Primitives.TextPrimitive).ShowKeyboardCues = True
            AddHandler CType(AMenuItems(i).Children(2).Children(0).Children(1).Children(0), Telerik.WinControls.Primitives.TextPrimitive).PropertyChanged, AddressOf MenuPropertyChanged
 
            If (TypeOf AMenuItems(i) Is myMenuItem) AndAlso (CType(AMenuItems(i), myMenuItem).Items.Count > 0) Then
                ShowMenuShortCuts(CType(AMenuItems(i), myMenuItem).Items)
            End If
        Catch
            'Failure
        End Try
        i += 1
    End While
End Sub
 
Public Sub MenuPropertyChanged(ByVal sender As Object, ByVal e As PropertyChangedEventArgs)
    Dim tPrimitive As Telerik.WinControls.Primitives.TextPrimitive
    tPrimitive = CType(sender, Telerik.WinControls.Primitives.TextPrimitive)
 
    If (e.PropertyName = "ShowKeyboardCues" AndAlso (Not tPrimitive.ShowKeyboardCues)) Then
        tPrimitive.ShowKeyboardCues = True
    End If
End Sub


I am pointing this out because it may be relevant to current issue.

Ok let's say you have this in place:
- You have parent window, with a menu, where one of the items has an accelerator key of "a".
- You have a child window, with a control, with an accelerator key of "a"
So two controls with the same accelerator key. Here is what you do with normal windows forms to invoke one or the other
- If you HOLD DOWN the Alt key, and press your accelerator letter at the same time, this invokes the control on the child window.
- If you press and RELEASE the Alt key, the focus is now on the menu, and you can then type "a" to invoke the menu item.

But here is what happens if the menu is a radmenu:
- I press and HOLD DOWN the Alt key, and then press "a" at the same time. Result? Focus goes to the menu. It should not, it should set focus to the control on the child form.

Thanks for looking.

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 10 Jun 2011, 10:05 AM
Hello Blair,

Thank you for reporting this issue.

I can confirm that the focus goes to the menu - we will consider changing this behavior.
In regards to the mnemonics, the Alt key is needed only when the focus is not on the control where you need to apply the mnemonic. After this control gets the focus, you can select an item only by pressing the mnemonic key, the Alt key is not needed anymore. If you want to change the selected item only when the Alt key is pressed, you should use the RadShortcuts approach.

We have added points to your account for the suggestions. Do not hesitate to contact us if you have other questions.

Greetings,
Peter
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
0
Laura
Top achievements
Rank 1
answered on 07 Jan 2016, 02:52 PM

Has there ever been a change to this behavior?  If not, what is the work around to give the active child form the priority so the first keyboard input is received by the child form and not the parent Menu?

 

Thanks!

Laura

0
Dimitar
Telerik team
answered on 08 Jan 2016, 09:25 AM
Hello Laura,

Thank you for writing back.

I can confirm that this behaviour is still the same. I have logged an issue for this in our Feedback Portal. You can track the item for status changes and add your vote for it here.

The only possible workaround I can suggest is to use RadShortcuts instead of mnemonics.  

Your Telerik Points have been updated for this report.

Should you have any other questions do not hesitate to ask.


Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Laura
Top achievements
Rank 1
answered on 08 Jan 2016, 01:51 PM
Thank you.  One question....   must I implement RadShortcuts for all of the items, buttons (which are on the form) as well as the RadMenu items in the parent form?
0
Dimitar
Telerik team
answered on 11 Jan 2016, 11:36 AM
Hi Laura,

Thank you for writing back.

You should add shortcuts only for the buttons which are having the same mnemonics chars. The issue occurs only when there are two controls with the same mnemonic char on my side.

I hope this helps.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Menu
Asked by
Blair
Top achievements
Rank 1
Answers by
Peter
Telerik team
Laura
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or