Board index » delphi » Focusing non-MDI and MDI child form : problem !

Focusing non-MDI and MDI child form : problem !

Hello .

I have MDI application , where one form is docked to the left border of main
form
(in fact, it is docked to panel, aligned to left side, like in "docking"
demo). This
docked form is not MDI child, it is of type fsNormal.

There is also another form , MDI child of main window. When I
open this MDI child, I can set focus on it. But when I put focus to docked
form , I can't
return focus back to this child . Child still responses to all actions like
resizing and
closing, but grid on this form does not receive focus again .

Funny thing is that when I undock first form, focus is switched successfully
between
two forms. But when first form is docked - no way ;(

Many thanks in advance for Your ideas !!

 

Re:Focusing non-MDI and MDI child form : problem !


Quote
In article <3cfe3b08_1@dnews>, Danka wrote:
> I have MDI application , where one form is docked to the left border of main
> form
> (in fact, it is docked to panel, aligned to left side, like in "docking"
> demo). This
> docked form is not MDI child, it is of type fsNormal.

> There is also another form , MDI child of main window. When I
> open this MDI child, I can set focus on it. But when I put focus to docked
> form , I can't return focus back to this child.

Sounds like the good old focus problem you get with a combobox or other
focusable control on the toolbar.

This is one of the many shortcomings of the Windows MDI framework, it has
never been designed to cope with controls outside the MDI children that can
take the focus. You can trick it by sending a WM_MDIACTIVATE message to the
active MDI child, here demonstrated by a OnClick handler for a combobox on the
toolbar:

procedure TMainForm.ComboBox1Click(Sender: TObject);
begin
  ... other actions
  If Assigned( ActiveMDIChild ) Then
    With ActiveMDIChild Do
      sendmessage( handle, wm_mdiactivate, 0, handle );
end;

--
Peter Below (TeamB)  
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

Other Threads