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

In OnShow I use a counter to only do the change on the first show. I've
even made a FirstShow event years ago.

I trust what you say since you are very experienced in Delphi and Lazarus,
however I could swear that I have been bitten by a bug before where not
all the components on the form are necessarily initialized in FormCreate.
i.e. I could swear that some components, aren't guaranteed to be fully
ready, just because a form is created....  Does the form create guarantee
the componenents are all ready for modification and initialized, because I
could absolutely swear that this has haunted me before where the form
itself is ready and created, but that didn't guarantee the children of the
form were all ready...

So a solution, was to put a counter in FormShow (local const var or
whatever you call those strange things that persist like a global, but are
still local) and access the components on the first show only.

If I could just find one other person that has been haunted by accessing
components in formcreate, then I'd confirm I am not imagining things and
my memory is solid. However, you've been programming far longer so... I am
wanting to trust what you say!
Lazarus mailing list

Reply via email to