We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

UserControl Focus on MDI Child Forms in .NET v1.1

Thread ID:

Created:

Platform:

Replies:

18154 Aug 24,2004 07:03 PM Windows Forms 0
loading
Tags: FAQ
Stephen Lee
Asked On August 24, 2004 07:03 PM

Hi All In moving our winforms application from .NET 1.0 to .NET v1.1, I have noticed a disturbing change in behaviour when it comes to remembering usercontrol focus once an MDI Child form loses, and then re-gains, focus. To illustrate: Say for example in an MDI application, you currently have two MDI Child forms open. The first of these MDI Child forms has 3 usercontrols on it, and the third of these UCs in the tab order has focus. Say I then press Ctrl-Tab to activate another MDI Child form within the application. If I then press Ctrl-Tab again to re-activate the first MDI Child, I would expect that third UC on the form to again have the focus. This is the way .NET 1.0 handles things. Instead I find that in v1.1 the first UC in the form''s tab order has focus, not the third. It seems that the form has "forgotton" which of the three user controls had focus when the form was deactivated (as part of the first Ctrl-Tab action). This behaviour is limited to user controls: Had those three controls on my form been Textboxes, for example, on reactivation of the form the third textbox in the tab order would have successfully been given focus again. This presents a very serious problem for us. Having a look under the covers I noticed that the user controls never have their Focused property set to True, even when they indeed have the focus, unlike a textbox. I tried overriding the Focused property within the User Control, but all to no avail, it seems the property is not used by the framework in the form deactivation process. Does anyone have any information about or workaround for this change in behaviour? As I said, this is going to cause us some pain, so any help would be greatly appreciated. If you would like to see this behaviour, please let me know as I have a small test winforms app that highlights the problem. Thanks Stephen Lee Perth, Western Australia

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;