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.
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() |
| { |
| InitializeComponent(); |
| } |
| 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) |
| { |
| button1.Focus(); |
| } |
| private void radMenuItem2_Click(object sender, EventArgs e) |
| { |
| button2.Focus(); |
| } |
| private void button2_Enter(object sender, EventArgs e) |
| { |
| button2.Text = "got focus"; |
| } |
| private void button2_Leave(object sender, EventArgs e) |
| { |
| button2.Text = "lost focus"; |
| } |
| } |