<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Aug 24, 2015 at 4:43 PM, Mattias Gaertner <span dir="ltr"><<a href="mailto:nc-gaertnma@netcologne.de" target="_blank">nc-gaertnma@netcologne.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Mon, 24 Aug 2015 16:29:49 +0200<br>
Martin Grajcar <<a href="mailto:maaartinus@gmail.com">maaartinus@gmail.com</a>> wrote:<br>
<br>
> In code I'm working on, I've found a pattern like<br>
><br>
> PROCEDURE HideIt;<br>
> BEGIN<br>
> SomeComponent.Visible := FALSE;<br>
> SomeComponent.Parent := SELF;<br>
> SomeComponent.Visible := TRUE;<br>
> END;<br>
><br>
> PROCEDURE ShowIt(NewParent: TForm);<br>
> BEGIN<br>
> SomeComponent.Visible := FALSE;<br>
> SomeComponent.Parent := NewParent;<br>
> ...some more stuff...<br>
> SomeComponent.Visible := TRUE;<br>
> ...some more stuff...<br>
> END;<br>
><br>
> I can't really see what it's good for. I guess, the idea was to preserve<br>
> the widget, but the widget seems to get freed immediately in the first<br>
> line. It comes from D7 or older. Does it make sense on Lazarus 1.4 using<br>
> GTK+?<br>
<br>
</span>No.<br>
Simply do "SomeComponent.Parent := NewParent;".<br></blockquote><div><br></div><div>Thank you for the information! Simplifying helped to get rid of a crash on Linux<br></div><div><a href="http://bugs.freepascal.org/view.php?id=28840">http://bugs.freepascal.org/view.php?id=28840</a><br></div><div>but there's still an event-related problem on Mac. Could someone tell me more about what problem may get solved by using the more complicated stuff?</div><div><br></div><div>Martin.</div></div></div></div>