Shortcut behaviour incorrect

6 posts, 0 answers
  1. Blair
    Blair avatar
    3 posts
    Member since:
    May 2011

    Posted 06 Jun 2011 Link to this post

    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.
  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 10 Jun 2011 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Laura
    Laura avatar
    11 posts
    Member since:
    Jan 2014

    Posted 07 Jan Link to this post

    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

  5. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 08 Jan Link to this post

    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
  6. Laura
    Laura avatar
    11 posts
    Member since:
    Jan 2014

    Posted 08 Jan in reply to Dimitar Link to this post

    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?
  7. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 11 Jan Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready