[Lazarus] Accessing components in FormCreate event

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Sep 22 11:07:04 CEST 2016


On Thu, 22 Sep 2016 09:50:06 +0100
Lukasz Sokol <el.es.cr at gmail.com> wrote:

>[...]
> From what I remember (on Turbo Delphi, but this is generally true I think)
> anything that causes the form to redraw,
> (as it's been indicated in responses here too - resizing, aligning, changing colours etc)
> is a really bad idea, because there may not be anything to answer the OnPaint events yet
> while FormCreate is being serviced.

There is no OnPaint during OnCreate.

 
> (Speculation because I haven't dived that deep: the visual component hierarchy on the form
> is kept in a tree-like structure, that is being walked top-down by a single thread, 
> and so other components' OnCreate is called AFTER their parent is created, and not necessarily
> in order of appearance (in order of being placed on form, presumably?) 

The order of dropping the components on the form defines the creation
order.

>[...]

Mattias


More information about the Lazarus mailing list