Focus bug when shifting focus from floating toolwindows

Docking/MDI for Windows Forms Forum

Posted 16 years ago by Chien A.
Version: 2.0.97
Platform: .NET 2.0
Environment: Windows XP (32-bit)
Avatar
When shifting focus from a floating toolwindow to a docked window, there seems to be an extra focus event in certain scenarios (eg when the previously selected toolwindow (prior to floating toolwindow) was another docked toolwindow.

Steps:

1) Open the demo dock project
2) Float the 'Welcome to UIStudio toolwindow
3) Select file|'Create 3 tooliwndows in a row'
4) Float the first newly created 'Toolwindow 1'
5) Now shift focus to the 'events' window

Note that in the events window, between the shift in focus from the floating 'toolwindow 1' to the 'events' window, toolwindow2 seems to momentarily become focused.

Shifting focus between 'Toolwindow 1' and the 'Events' window after this works correctly from now one, but if focus is shifted to 'toolwindow 2' then 'toolwindow 1' then to 'events' again, the same extra 'toolwindow 2' focus event occurs.

Comments (1)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I think the problem here is just part of Windows focus works. Basically the WindowFocused event fires when focus enters a tool window. After you float 'Toolwindow 1' and then click back on the 'Events' window, your click first activates the 'Dock C# Sample' main Form before it is registered. During that activation, focus is restored to the Form at its previous location, which in this scenario is 'Tool Window 2'. However immediately your mouse click moves focus to the 'Events' too window, so the 'Tool Window 2' only has focus for a split second.

I'm not sure anything can be done to prevent this from happening since it is how Windows works. When a parent Form gets activated, focus is restored to its last child control that had focus before the new click is processed. And that is what causes this scenario.


Actipro Software Support

The latest build of this product (v24.1.0) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.