Control.Leave and undocked windows

DockableWindow/TabStripPanel for Windows Forms Forum

Posted 19 years ago by kh - United Kingdom
Avatar
hi. in my application i need to know when focus enters and leaves certain controls. this works well if all windows are docked but if i move focus from, say, a control in a document window to a control in an undocked tool window the Leave event for the control in the document window is not fired. any ideas?

thanks

kh

Comments (6)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I think that's standard .NET framework behavior since you are changing Forms, the document window still has focus on the main form.


Actipro Software Support

Posted 19 years ago by kh - United Kingdom
Avatar
yeah, figures. can you think of a way i can simulate the behaviour i am after? basically i don't want all controls to have to implement some kind of GotFocus event because this creates an implementation constraint on my developers. however, all controls that must be 'monitored' are forced to implement Enter and Leave handlers. i just need to be able to set context of 'monitored' controls according to the current selection.

thanks

kh
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
How about possibly hooking into the Form.Deactivate event for your main form. That should tell you when another window gets activated.


Actipro Software Support

Posted 19 years ago by kh - United Kingdom
Avatar
thats a start, but what if the 'monitored' controls are both in undocked windows? i cannot find any event which reliably fires when focus moved from one undocked tool window to another.

thanks

kh
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
If you are using UserControls as your tool window child controls, you can examine OnEnter or OnLeave of those.

This is an item that we've wanted to improve. We're actually very close to having a beta complete for our completely redesigned dock controls. In those there is a WindowFocused event that fires whenever a tool or document window gets focus.

The new dock controls are much better designed internally and provide granular control over what tool windows can do. They also let you control how the entire dock system renders so it comes with samples for VS.NET 2005, 2002, and Office 2003 styles built in. The new controls are a huge improvement over DockableWindow and you will be able to upgrade to them for free if you have an active DockableWindow annual subscription when they are released. If not, DockableWindow owners will be able to pay upgrade pricing to get them. But trust me, it will be worth it. The suite that contains the new controls also comes with a TabStrip control and a NavigationBar control (like in Outlook 2003). Keep an eye on our web site since a beta should be be available very soon.


Actipro Software Support

Posted 19 years ago by XMunkki
Avatar
I guess I'm having the same kind of problems. I need to know whether a tool window child or a document window child is activated/deactivated. It works almost all the way there by assigning listeners to Control.Enter and Control.Leave, but when the docked control is in it's own window, no such events arise. The event does however come when the window is opened/closed. Hooking UserControl.OnEnter/OnLeave seems to do the same thing.

I'd really hope this could be resolved as some of my functionality depends on tracking which child control is actually active.
The latest build of this product (v2.0.0208) was released 19 years ago, which was after the last post in this thread.