D2006, and *I* get 0, -1, -1... no error
> -----Original Message----- > From: delphi-boun...@delphi.org.nz [mailto:delphi- > boun...@delphi.org.nz] On Behalf Of Karl Reynolds > Sent: Tuesday, 16 February 2010 4:16 p.m. > To: NZ Borland Developers Group - Delphi List > Subject: Re: [DUG] Is it a bug in latest version of Delphi? > > On Tue, Feb 16, 2010 at 3:57 PM, Jolyon Smith <jsm...@deltics.co.nz> > wrote: > > Good luck with GetLastError(). There's nothing to indicate that > > LB_GETITEMDATA processing will set a Windows "LastError". > > > > And empirically I would have to say that it doesn't: > > Hmm... empirically I would have to say it does. > > type > TIPRListBox = class(TListBox); > > procedure TForm1.Button1Click(Sender: TObject); > > function GetValue(AListBox: TListBox; AIndex: Integer): Integer; > begin > Result := TIPRListBox(AListBox).GetItemData(AIndex); > if GetLastError <> 0 then RaiseLastOSError; > end; > > begin > ListBox1.Items.AddObject('foo', TObject(0)); > ListBox1.Items.AddObject('foo', TObject(-1)); > ShowMessage(IntToStr(GetValue(ListBox1, 0))); > ShowMessage(IntToStr(GetValue(ListBox1, 1))); > ShowMessage(IntToStr(GetValue(ListBox1, 2))); > end; > > Tested results: 0, -1, <invalid index error> > > I'm using D2006, and you? > > Cheers, > 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 _______________________________________________ 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