Mdi child looses focus

Howdie!

I have an Mdi application with a child window containing an editor (and a
list). When I switch between Mdi children, I manage to give the focus to the
editor child in the Mdi child. However, when I switch between applications,
the focus of the editor is lost.

I catch WM_ActivateApp in the main window, and i successfully identifies the
top Mdi child, but I fail to give focus to the editor.

I use this in the Mdi child window procedure:

    WM_MdiActivate:
      If LParam=Mdi Then Begin        { if activated }
        Proj:=GetProject(Mdi);        { get object for Mdi child }
        SetFocus(Proj^.Edit);        { sets focus to the editor child }
      End;

I have this in the window procedure of the main window:

    WM_ActivateApp:
      If WParam<>0 Then Begin        { if activated }
        If GetTopProject(Proj) Then Begin    { get object for Mdi child }
          WriteLn('Focus');        { to show that we really get here }
          SetFocus(Proj^.Edit);        { has no effect }
        End;
      End;

Why does this not work?

/GreenGhost
---
http://hem.passagen.se/guffa/en
---
kill the spammer to mail me