Board index » delphi » D2: Handling multiple MDI Children

D2: Handling multiple MDI Children

My MDI-app seemed to work (as far as it was finished anyway), but when I
opened a second ChildWindow strange things started to happen. The first time
it didn't show it's contents after a hide/show-combination and the second
time my app hang. So I'm doing something wrong apparantly...

At the moment all actions performed on my child-windows are performed on
the ActiveMDIChild ( using the type-cast "TMDIChild( ActiveMDIChild )" ). Is
this the right way ?
Is information lost when I switch between MDI Children ?
-----
Alban Hertroys
e-mail: A.G.Hertro...@student.utwente.nl
WWW:    http://wit401310.student.utwente.nl/
The Netherlands
-----
...I'll make no subscription to your paradise. (Crass / Stations of the cross)

 

Re:D2: Handling multiple MDI Children


In article <4q3ps0$...@dinkel.civ.utwente.nl>, "A.G.Hertroys" <A.G.Hertr
o...@student.utwente.nl> writes

Quote
>My MDI-app seemed to work (as far as it was finished anyway), but when I
>opened a second ChildWindow strange things started to happen. The first time
>it didn't show it's contents after a hide/show-combination and the second
>time my app hang. So I'm doing something wrong apparantly...

>At the moment all actions performed on my child-windows are performed on
>the ActiveMDIChild ( using the type-cast "TMDIChild( ActiveMDIChild )" ). Is
>this the right way ?
>Is information lost when I switch between MDI Children ?

Why your app. hangs I don't know but TMDIChild is a valid typecats once
you've ascertained the form is of this type.  No data will be lost due
to OO encapsulation.

How do you actually create the form?  Is the only MDIChild the
TMDIChild, perhaps an invalid type cast occurs.

Lastly, are you using one variable to create the children?

  for instance

var
        fmychild: tfmychild;

begin
  fmychild := tfmychild.create (application);

do you do this more than once, if so then thats probably your problem.

--
Nicholas Robinson

Re:D2: Handling multiple MDI Children


Quote
A.G.Hertro...@student.utwente.nl (A.G.Hertroys) wrote:
>At the moment all actions performed on my child-windows are performed on
>the ActiveMDIChild ( using the type-cast "TMDIChild( ActiveMDIChild )" ). Is
>this the right way ?
>Is information lost when I switch between MDI Children ?

Actions you perform on a child don't have to be on ActiveMDIChild if there from
the child's unit itself. The code within the child is always on the active
child itself. ActiveMDIChild comes in mind when you want to perform something
from within the frameform for example. But normal actions, like for example a
cut operation to the clipboard, is just like in any other non MDI-app.

As far as I know, information will not be lost, as long as you declare the
variables in the private section of the declarations (within the child-unit,
that is).

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ File & Mailboard AD FUNDUM - The Netherlands - Powered by Win95 +
+ +31-320-282104  ***  No sHiT - JuSt EnJoY  ***  RA 2.02/FD 2.12 +
+           http://web.inter.nl.net/users/Rogier.Meurs            +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Re:D2: Handling multiple MDI Children


In article q...@dinkel.civ.utwente.nl, A.G.Hertro...@student.utwente.nl (A.G.Hertroys) writes:

Quote
>My MDI-app seemed to work (as far as it was finished anyway), but when I
>opened a second ChildWindow strange things started to happen. The first time
>it didn't show it's contents after a hide/show-combination and the second
>time my app hang. So I'm doing something wrong apparantly...

>At the moment all actions performed on my child-windows are performed on
>the ActiveMDIChild ( using the type-cast "TMDIChild( ActiveMDIChild )" ). Is
>this the right way ?

Sounds about right to me, but my current project is  nonMDI so I may have forgotten  !
Make  sure  you don't have a one off MDIChild form defined in the MDIChild form unit,
which is placed there automatically by Delphi. That may confuse things. Simply have the
form variable defined in the code that creates a new child.

Quote
>Is information lost when I switch between MDI Children ?

I hope not !

Quote
>-----
>Alban Hertroys
>e-mail: A.G.Hertro...@student.utwente.nl
>WWW:    http://wit401310.student.utwente.nl/
>The Netherland.

HTH

Ray Cramer
R...@Pol.ac.uk

Other Threads