Yes thats true. they could rewrite the VCL code to cater for that issue. Cant say I've ever actually encountered this problem before.
normally if I am binding anything in a list box, then I am binding a real pointer to some other object that might contain an integer property.. I dont think I've ever used it to store an integer that was not a real pointer. On Tue, Feb 16, 2010 at 2:54 PM, Jeremy North <jeremy.no...@gmail.com>wrote: > True, but as Joylon correctly points out, you can (in the VCL) > actually cater for the difference in a "real" index out of bounds > error and a LongInt(TObject) typecase returning -1. > > It's a bug and should be logged on QC, if it isn't there already. > > On Tue, Feb 16, 2010 at 12:50 PM, Kyley Harris <ky...@harrissoftware.com> > wrote: > > interesting > >> if Longint(Result) = LB_ERR then Error(SListIndexError, Index); > > it would seem that the error is not in delphi at all. Well.. they are > simply > > raising the Windows error which say that -1 is the error result for a bad > > index access from windows. if delphi were to ignore this error and you > asked > > for the value at index[99] which was out of bounds and you got -1 instead > of > > an error I think there would be the same number of complaints from the > other > > side. > > Clearly its the windows API that considers -1 invalid.. not delphi. > > > > On Tue, Feb 16, 2010 at 2:24 PM, Karl Reynolds > > <kreyno...@chocfishsoft.co.nz> wrote: > >> > >> On Tue, Feb 16, 2010 at 1:55 PM, Alister Christie > >> <alis...@salespartner.co.nz> wrote: > >> > 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. > >> > >> Only if you stipulate that you have to remain ignorant of the function > >> internals. The TObject is converted back and forth from a LongInt in > >> order to store it anyway (see GetObject and PutObject). > >> > >> > The fact that -1 doesn't work > >> > is therefor not a bug (unless you can have 1 byte sized objects). > >> > >> var x: longint; > >> > >> x := -1; // Four bytes > >> > >> (May the source be with you). > >> > >> Cheer, > >> Karl > >> _______________________________________________ > >> 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 > > > > > > > > -- > > Kyley Harris > > Harris Software > > +64-21-671-821 > > > > _______________________________________________ > > 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 > -- Kyley Harris Harris Software +64-21-671-821
_______________________________________________ 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