Menu item physical click retains focus

2 posts, 0 answers
  1. Loy Chan
    Loy Chan avatar
    21 posts
    Member since:
    Mar 2008

    Posted 21 Nov 2008 Link to this post

    I have a Radmenu that I use to switch between different views on my spreadsheet control.

    My click event will call a method to flip the active sheet on my spreadsheet control and then set the focus to that control.

    The odd thing is that if I physically click the menu item, the focus will move to my spreadsheet control and then immediately go back to the menu item. But if I use the keyboard and press "space" on the menu item, the focus will remain on the spreadsheet control (as expected).

    I tested this with a sample app that has a radmenu with 2 items, and two buttons. Each menu item will set the focus to a button. Each button has a Enter and Leave event that updates the text of the button.  The behaviour I'm noticing is replicated in this project.

        public partial class Form1 : Form  
            public Form1()  
            private void button1_Enter(object sender, EventArgs e)  
                button1.Text = "got focus";  
            private void button1_Leave(object sender, EventArgs e)  
                button1.Text = "lost focus";  
            private void radMenuItem1_Click(object sender, EventArgs e)  
            private void radMenuItem2_Click(object sender, EventArgs e)  
            private void button2_Enter(object sender, EventArgs e)  
                button2.Text = "got focus";  
            private void button2_Leave(object sender, EventArgs e)  
                button2.Text = "lost focus";  
  2. Jack
    Jack avatar
    2335 posts

    Posted 25 Nov 2008 Link to this post

    Hi Loy Chan,

    Thank you for contacting us.

    This issue appears only when clicking on main menu items. Actually, the focusing of RadMenu can't be disabled. I would suggest moving your logic inside the MouseUp event of the desired menu item. Another approach would be to use RadToolStrip instead of RadMenu.

    Should you have other questions I will be glad helping you.

    Sincerely yours,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft R3 2016 release webinar banner
Back to Top