----- Original Message ----- From: "Mattias Gaertner" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, March 20, 2006 12:03 PM
Subject: Re: [lazarus] TXMLPropertyStorage question


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,
What would you like to put into the handler? This is the same code, so what is the difference? Calling OnClosing from Close or Application.MainForm.Close is essentially the same right? My problem is that on Application.MainForm.Close the MyForm.Close never get called. So I don't see how adding OnClosing would fix the issue.

or add an OnMainFormClose handler to application
and each storage hooks into this.
A form created on the fly without a parent is not hooked to TApplication (by default) because that is done by Application.CreateForm right?

Darius
_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to