On Wed, 21 Sep 2016, Lars wrote:

I'm trying to remember if setting up some values of components is okay to
do in the form create event. From what I remember in Delphi days of
programming years ago, I think I found out the hard way that setting up
components in the FormCreate event was a bad idea, and I had to resort to
tricks like doing it in the FormShow event instead, using a counter to
only do it on the first show.

Do I recall correctly? Is it bad practice to set up some components on the
form in the formcreate event, because of timing and issues with the
components not all being set up in time?  I recall, but cannot be sure,
that in Delphi this led to issues and bugs where if you accessed
components on the form in the formcreate event, it was too soon for some
components as they had not initialized yet. I can't remember for sure
though, and Lazarus may be different.

No, formcreate is the correct event to set up new components. OnShow may be called multiple times in the lifetime of a form.

Lazarus mailing list

Reply via email to