Board index » delphi » Delphi1: GPF everywhere!
Matthias Bolliger
![]() Delphi Developer |
Mon, 28 Jun 1999 03:00:00 GMT
Delphi1: GPF everywhere!David Preece <dmpre...@dreams.co.uk> wrote Quote> Hi. TMDIParent(Parent) does no error checking, BTW. The syntax (Parent as TDMIParent) will raise an exception immediately if the type cast is invalid. But if you know the cast is valid, the first syntax is quite OK and faster. Quote> procedure TMDIChild.Something1Click(Sender: TObject); But this seems like a case where a global variable is "allowed". var GlobalMDIParent: TMDIParent; There can be only one MDI parent form in an application, and it is a truly global object. So on FormCreate of the MDI parent, put e.g. GlobalMDIParent := Self, and use GlobalMDIParent.Procedure. Quote> Whilst on the subject, am I right in thinking that when I declare a This is one of the minor "valid" bashing subjects against Pascal from C++ folks. It slows down the use of local/temporary objects a little. But it also simplifies parameter passing and reduces the risk for additional GPF's caused by late night programming, a habit that will be around for a while, I think :) Best wishes, |