Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
577
CustomColorBox in menu steals focus - focus returns to control not having focus before
posted

When the CustomerControlBox drops down it gets focus. I understand this is by design. However focus is not restored to the control having focus before the drop down.

My application consists of one or more grids managed by an UltraMdiTabManager, to the right there are FormattedTextControls docked at the right edge.

If I describe the scenario causing problem:

1. Click/type in one of the TextControl, that becomes the active control

2. Click/type in the grid, that receives focus but the text control is still shown as the active control from my main form

3. When the color box drops down it gets focus

4. When the ColorChanged event fires, focus has been set to the TextControl which was active but did not have focus, but not to the grid that previously had focus, meaning my color command is sent to the wrong control

Regardless of what I do in terms of ActiveControl or Select it seems I can not get the main form to see the grid with focus as the active control. I assume that focus is restored to the active control?

I currently have a work around by identifying the control with focus in BeforeToolDropDown event handler recursively using ContainsFocus instead of ActiveControl and then restoring focus before applying the color command. This works OK.

However I assume there is a better solution, any suggestions?

Parents Reply Children
No Data