Hi, it's been a while since I've played with MDI forms, but from my experience the concept of focus is a little strange with MDI parent/child.
The GotFocus even on an MDI parent fires when the child window gets focus. Despite this, the MDI parent itself never actually has focus, it's the child windows that have focus.. You can see this behavior really easily by adding 2 child forms to an MDI container with different debug messages in each of the GotFocus events. The child forms will never fire the GotFocus event but the parent form will fire the GotFocus event every time the active child form changes.. Hope this helps a little.. Ed. On Wed, Jul 7, 2010 at 2:01 PM, Arjang Assadi <[email protected]>wrote: > Here is an ugly hack: > In the Activated event of the child mdi form , set the focus back to > the mdi parent. > > On 7 July 2010 13:27, Anthony <[email protected]> wrote: > > Doesn’t work..no matter what i do..the mdi child form gets the > focus..really > > weird. > > > > > > > > > > > > From: [email protected] [mailto: > [email protected]] > > On Behalf Of Greg Keogh > > Sent: Wednesday, 7 July 2010 11:03 AM > > To: 'ozDotNet' > > Subject: RE: MDI Form > > > > > > > > Hi Anthony, I find that setting the Focus() in Load doesn’t work because > > it’s too early, so I usually do it in the first Activate event. I often > have > > code like this: > > > > > > > > If (++activateCount == 1) > > > > { > > > > Thing.Focus(); > > > > // Other stuff for the first time everything is visible > > } > > > > > > > > You may have to set the focus to a specific control, not the whole form. > I > > haven’t tried any of this with MDI though. > > > > > > > > Greg > -- Eddie de Bear Mob: 0417066315 Messenger: [email protected] Skype: eddiedebear
