I think the point I was trying to make is that it is that the method (/array indexer or whatever) was expecting a TObject - passing anything else could result in unexpected results. The fact that -1 doesn't work is therefor not a bug (unless you can have 1 byte sized objects).
Alister Christie Computers for People Ph: 04 471 1849 Fax: 04 471 1266 http://www.salespartner.co.nz PO Box 13085 Johnsonville Wellington Jolyon Smith wrote: >> you should care greatly, because this is violating OOP principles >> > > I care about code that works and gets a job of work done. "OO Principles" > are for the classroom. > > > >> Obviously the GetObject source cares somewhat about what -1 points to. >> > > No, it doesn't. It simply gets confused because the Windows API uses "-1" to > indicate that an error occurred in retrieving an item's data and the VCL is > then naively assuming that ANY error in retrieving an item's data must be a > List Index error. > > Even though it could (and should) specifically test for index validity before > calling the API and so discount that possible source of an error from the > outset. > > Indeed, the TObject(-1) result is cast BACK to a LongInt(-1) for testing > against the simple value LB_ERR (which == -1) ... the source of this error > has nothing what-so-ever to do with the casting of the value as TObject. > > > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: > unsubscribe > > _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe