[Lazarus] How to close a window from code

zeljko zeljko at holobit.net
Thu Feb 2 07:29:40 CET 2012


On Wednesday 01 of February 2012 19:19:11 Alexsander Rosa wrote:
> Or even (Self as TForm).Close for that matter.

What if he calls Close from class which isn't TForm ?
Form1.Close can be used, but in that case he must take care of Form1 ...
anyway it's bad programming tehnique.

zeljko

> 
> 2012/2/1 Rich Saunders <saunders.richard.p at gmail.com>
> 
> > On 2/1/12 12:49 PM, Timothy Groves wrote:
> > > However, the Form1.Close version did, and that's what I'm using. 
> > > Thanks!
> > 
> > Tim-
> > 
> > Note that using Self.Close; would be safer and much preferred over
> > Form1.Close; when called within a TForm1 class method.
> > 
> > It does not rely on the Form1 instance reference to be present and
> > usable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120202/42c79571/attachment-0003.html>


More information about the Lazarus mailing list