>> When I have any MDI Child windows open, and Close the the MDI Frame
>> window, I get this message:
>> 'Cannot Create Form. No MDI Forms are currently active'
>> Well I would hope so, that's what anyone 'windows programmer' would
>> want.
>> The correct behavior should be for the MDI Frame window to query each
>> MDI Child window, and if all children allow closing, the MDI Frame
>> window closes.
>> What hand-holding backward-philosophy is Borland using her?
>> -- The 'I am just dying to automatically create a window for you'
>> philosophy <g>?
>> Wouldn't it be great if Borland would simply allow us to 'write'
>> traditional Windows software instead of trying to hold our hands
>> always?
>> In all my windows (in a subclass) I always use the FormClose event to
>> set Action:TCloseAction to caClose, as Borland should have defaulted
>> to.
>> I am using Delphi 2.01.
>> I create my own MDI Child windows, no autocreate.
>> Thanks in advance,
>> --------------------------------------------------------
>> Steven Elwell
>> Miami, Florida
>> --- EMail Addresses ----------------------
>Don't know if this helps, but I have found out that when closing
>the frame window, any code in the OnClose event of MDI children will NOT
>be executed. Not at all.
>And I believe the general tip is to use caFree instead of caClose.
I think my OnClose events work. Are you talking about 32-bit? That's
what I use. No 16-bit unless I am forced to.
I use caFree - exclusively. Any other concept makes little sense to
me. I create my MDIChild windows and never let their autocreate do
it. Still when closing the frame, with 1 or more children open, I get
the message. Maybe I am missing some Delphi concept. I'll map it all
out when I have the time.
My solution was to totally ignore all of the QueryClose stuff built
into Delphi and use FormClose in my MDIFrame class to control the
shutting down of MDIChild windows. In my MDIFrame's FormClose event
handler, I query my children, configurable to the concepts of:
CloseIfAllOK (default behavior - all must say it is OK)
CloseAllOK (Close all that are OK, if any remaining then we can't
close)
CloseAllWhileOK (keep asking and closing until done or 1 says NO)
My MDIChild class has a property called Dirty, so that's what I query
in MDIFrame. If it is TRUE, the I call MDIChild.OKToClose().
If I can close the MDIFrame window, I set the MDIFrame's
OnClose:Action to caFree, otherwise I set it to caNone. This is the
way Win API apps typically close. I don't know why my apps are
behaving differently. Maybe I am doing something anti-Delphi.
If you have similar problems, I could send you the code, maybe twenty
total lines to get it all working as one would expect.
Good luck,