Link to home
Start Free TrialLog in
Avatar of ntony
ntony

asked on

MDI Child Close Event

I have an MDI application. I want to know if there is an event for child close.
i've tried :

  if Message.Msg=WM_MDIDESTROY then begin
     ShowMessage('Child closed');
  end else inherited WndProc(Message);

but it does not work. Can anyone tell me why?
Avatar of kretzschmar
kretzschmar
Flag of Germany image

why not use the onClose.event of your MDIChild?
Avatar of ntony
ntony

ASKER

I have a list with child window so i need to delete the child when it will be closed.

Is the childform really closed in your program.
You can try to write some codes in the two event:OnClose,OnDestroy.
Just like showmessage('c') in onclose;showmessage('d') in onDestroy.
You will find that when you close the Childform,only show "c" ;
When you add "action :=caFree" in OnClose,you will see "d";
So...maybe you will find the right answer.

I guess but not test the following code;
if Message.Msg=WM_Close then begin
     ShowMessage('Child closed');
  end else inherited WndProc(Message);
you could notify the mainform in the onClose-event of your MDIChilds instead

may this possible for you?
Avatar of ntony

ASKER


huiyue i've used caFree on the child form.

Kretzschmar - i need a simple solution
how shows your list?
by classname or by formname?
Avatar of ntony

ASKER

is't a stringlist with objects TForm
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial