Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2020-09

FormClose

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Santiago A.

Hi:

I recently have read a message where an object was created in the FormCreate and was freed in the formClose.  What if the form is not freed? I think that the the natural place to free objects created in formCreate is FormDestroy.
In fact, I usually follow this pairs
Created in FormCreate, freed in FormDestroy
Created in FormActivate, freed in FormDeactivate
Created in FormShow, freed in FormHide

I seldom use formClose, just to change the default closeAction.  I can't see what else is formClose for. Do you use it form any other case?

Saludos Santiago A.

Reply by email

Vojtěch Čihák
to Santiago A.

Hi,
 
FormClose is opposite to FormShow. The use-case is a modal form which exists always (i.e. is autocreated when app. starts and is freed when app. end). You can call ShowModal, create some objects in FormShow and free them in FormClose.  
V.
______________________________________________________________

Show quoted text 5 lines
Od: "Santiago A. via lazarus" Komu: Datum: 08.09.2020 21:00 Předmět: [Lazarus] FormClose

Hi:

I recently have read a message where an object was created in the FormCreate and was freed in the formClose.  What if the form is not freed? I think that the the natural place to free objects created in formCreate is FormDestroy.
In fact, I usually follow this pairs
Created in FormCreate, freed in FormDestroy
Created in FormActivate, freed in FormDeactivate
Created in FormShow, freed in FormHide

I seldom use formClose, just to change the default closeAction.  I can't see what else is formClose for. Do you use it form any other case?

Saludos Santiago A. --

Reply by email