[SOLVED] How to get component parent at designtime / runtime lazarus / 31-LCL ---------------------------------------------------------------------- pcurtis · 2022-02-27 17:35 How do I get a components parent (not owner) at designtime / runtime? I have tried this, but it fails the parent is nil.... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i constructor TMyTest.Create(AOwner : TComponent);begin  inherited Create(AOwner);   Enabled:= Parent.Enabled;  <-- fails here .... ---------------------------------------------------------------------- Onur2x · 2022-02-27 18:33 constructor TMyTest.Create(AOwner : TComponent); begin   inherited Create(AOwner);  Parent := AOwner as TWinControl;  Enabled:= Parent.Enabled;  <-- fails here ---------------------------------------------------------------------- af0815 · 2022-02-27 18:41 I think, create is not the correct place to look for the parent. Because you say correct the owner must not be the parent. IMHO you cannot set the enabled here, because the parent maybe not set here (only the owner). And Enabled is normaly controlled by the parent. If the Parent is not enabled, it makes no sense a child to be enabled. Or i am wrong. Look in IsEnabled how this can work, with the correct checks angainst a parent is available or not. ---------------------------------------------------------------------- pcurtis · 2022-02-27 19:08 Thanks jamie.