Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Menu, Application Menu, Context Menu > Shortcut behaviour incorrect

Not answered Shortcut behaviour incorrect

Feed from this thread
  • Blair avatar

    Posted on Jun 6, 2011 (permalink)

    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.

    Reply

  • Peter Peter admin's avatar

    Posted on Jun 10, 2011 (permalink)

    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.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Menu, Application Menu, Context Menu > Shortcut behaviour incorrect
Related resources for "Shortcut behaviour incorrect"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]