locked
MDI child focus issues RRS feed

  • Question

  • I have a MDI child forms in C# 2.0 with .NET 2.

    The problem I'm having is that the forms will not get focus if I click in the middle of the contents, only if I click on the header.

    Any hints on solving this one?

    Tuesday, August 15, 2006 2:27 AM

Answers

  • Hi,
    I run a sample and I can't see it. Do you have some override function or event handler you implement?
    Tuesday, August 15, 2006 6:11 AM
  • Hi,
    I'm not sure whether it will work ok. But give it a shot.


    Protected Overrides Sub WndProc(ByRef m As Message)
        If (m.Msg = 33) Then 'WM_MOUSEACTIVATE
            Me.Activate()
        End If
        MyBase.WndProc(m)
    End Sub

     

    Tuesday, August 15, 2006 8:47 AM

All replies

  • Hi,
    I run a sample and I can't see it. Do you have some override function or event handler you implement?
    Tuesday, August 15, 2006 6:11 AM
  • Was just attempting to see if there was any obvious bugs associated with this, since I did a search through the posts here to WinForms.General and found there were problems that were similar in the past.

    My particular implementation uses CrownWood for the tabbing and docking facility so will investigate further into this now that i know its not a common bug.

    Tuesday, August 15, 2006 6:38 AM
  • Hi,
    I'm not sure whether it will work ok. But give it a shot.


    Protected Overrides Sub WndProc(ByRef m As Message)
        If (m.Msg = 33) Then 'WM_MOUSEACTIVATE
            Me.Activate()
        End If
        MyBase.WndProc(m)
    End Sub

     

    Tuesday, August 15, 2006 8:47 AM
  • Just a quick thank-you note; this solved (one of) the problems I've been pouring time into while fighting with MDI.

    Kind of scary, seems like setting MdiParent really breaks something under the hood... Overall, I'm beginning to consider switching to wxWidgets because of all the WinForms quirks. Hopefully WPF will spread quickly so we can abandon this mess.

    Wednesday, October 18, 2006 5:41 PM
  • The MDI problems aren't so much a winforms problem, more a win32 problem. MDI is just dodgy, which is why we switched over to dock panel style system. Like SandDock or DotNetMagic. Similar to VS2005 docking.
    Thursday, October 19, 2006 10:58 AM