On 22/09/16 08:13, Luca Olivetti wrote: > El 22/09/16 a les 08:47, Lars ha escrit: > >> >> However these may be issues with formcreate that are not related to >> the bugs I have come across. I'm trying to remember what exactly >> was the problem that I had in FormCreate, but can't remember > > > I don't remember exactly, but the size of the component isn't the > final one (depending on align, anchors or autosize, as I said I don't > remeber the details) until the FormShow, so if you need them to > initialize other components you have to wait. > > Bye
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. (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?) Whereas in On(First)Show of the main form you can assume the entire tree exists and has sizes and positions calculated at least once) Hope it's not overly far from truth ;) -L. -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus