On Mon, 20 Mar 2006 11:05:31 +0100 (Romance Standard Time)
Michael Van Canneyt <[EMAIL PROTECTED]> wrote:
>
>
> On Mon, 20 Mar 2006, Mattias Gaertner wrote:
>
> > On Mon, 20 Mar 2006 10:32:13 +0100 (Romance Standard Time)
> > Michael Van Canneyt <[EMAIL PROTECTED]> wrote:
> >
> >>
> >>
> >> On Mon, 20 Mar 2006, Mattias Gaertner wrote:
> >>
> >>> On Mon, 20 Mar 2006 09:20:20 +0100 (Romance Standard Time)
> >>> Michael Van Canneyt <[EMAIL PROTECTED]> wrote:
> >>>
> >>>>
> >>>>
> >>>> On Mon, 20 Mar 2006, Darius Blaszijk wrote:
> >>>>
> >>>>> I have found some unexpected behaviour with the storing of form
> >data. >>>>
> >>>>> I have two forms, the second form is shown from the first one (just
> >a >>>> simple show). When I change the position for instance and close
> >the >>>> second form the data is stored. It works like expected. However,
> >when >> I >> close the first form (quit the application) no data is
> >stored for >> the >> second form.
> >>>>>
> >>>>> I have looked on how to solve the problem, but I'm not really good
> >in >>>> this, hence my question. I would like to expand the
> >>> TFormPropertyStorage >> class, so data is stored on destroy (or should
> >it >> be free). Proposed >> changes are;
> >>>>>
> >>>>> - add a fhtDestroy to TFormHandlerType
> >>>>> - add a AddHandlerDestroy to TCustomForm
> >>>>> - add a destroy handler in TFormPropertyStorage.Create
> >>>>> - add a destroy method in TFormPropertyStorage
> >>>>>
> >>>>> Have I forgotten anything, or am I on the wrong track?
> >>>>
> >>>> I'm not sure that handling it in the ondestroy event is a good idea:
> >it >>> may be 'too late' at that time.
> >>>
> >>> Correct.
> >>> Maybe instead TFormPropertyStorage should save, when the
> >>> Application.MainForm is closed.
> >>
> >> What do you do with other forms then ? I create my forms dynamically,
> >> and they should have their stuff saved when they are closed, because
> >> right after that, they are destroyed.
> >
> > I meant instead of saving on destroy.
> > The Storage must be saved on Closing a form _and_ closing all forms
> > (=close mainform).
> > Maybe when the application shuts down, all open forms should trigger an
> > OnClose?
>
> This is not Delphi compatible, so I would advise against it...
> (I tested a delphi app: secondary forms do not get an onclose.
> They are simply destroyed.
Ok. Then either add an OnClosing handler (without an event, there is no need
yet) to TCustomForm, which will be called by Close and
Application.MainForm.Close, or add an OnMainFormClose handler to application
and each storage hooks into this.
Mattias
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives