Shortcut in inactive window

4 posts, 0 answers
  1. Ole
    Ole avatar
    3 posts
    Member since:
    Apr 2012

    Posted 14 Aug 2012 Link to this post

    When we assign shortcuts to a RadMenuItem in a context menu on a form, the shortcut is also triggered when the form is not active.

    The shortcut is working properly when the form is active, but when the form shows a modal dialog on top, the shortcut from the underlaying window is still active and can be triggered.

    How can we change this behaviour?
  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 16 Aug 2012 Link to this post

    Hello Ole,

    Thank you for contacting Telerik support.

    This is the default behavior of our context menus and it cannot be modified. You can avoid this with explicit check if the form is active in the item click event, for example:

    void radMenuItem1_Click(object sender, EventArgs e)
    {
                if (!this.Focused)
                {
                    return;
                }
     
                MessageBox.Show("Click");
    }

    Do not hesitate to contact us if you have other questions.

    Greetings,

    Peter
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ole
    Ole avatar
    3 posts
    Member since:
    Apr 2012

    Posted 16 Aug 2012 Link to this post

    Thank you for the answer, the solution will fix the problem. But it is slightly confusing, as the following link to the dokumentation states that RadItem shortcuts only are executed when the for is active. Maybe the documentation needs to be fixed. http://www.telerik.com/help/winforms/shortcuts-assigning-global-radshortcuts.html
  5. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 17 Aug 2012 Link to this post

    Hi Ole,

    Yes, you are correct - this is not valid for RadMenuItems placed in the RadContextMenu. ContextMenus behave differently, because they are components and actually are not members of the form Controls collection.

    We will consider updating our documentation. Thank you for the cooperation.

    All the best,
    Peter
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Back to Top