Article View: borland.public.delphi.language.objectpascal
Article #152Is this a valid use of @
From: Neil Joyce
Date: Wed, 07 Apr 2004 09:14
Date: Wed, 07 Apr 2004 09:14
41 lines
2399 bytes
2399 bytes
Sorry for such a basic question but I have been away from Delphi
pointers for a while. I have come up with the solution below to code
the contents held in the TListItems in a TListView and have them
relate to data harvested elsewhere in the application.
This yields a "152:variable required" error. How can I get this to
work; or can anyone suggest another way to link a TlistItem to the
strings in a TStringList another in a seperate list.
procedure TPeopleForm.UpdateContactsDisplay();
var
i,orgs:integer;
str:string;
display_all,display_this_contact:boolean;
PtrToContactNumber:^String;
begin
display_all:=IncludeObsoletePeopleByOrgsCB.Checked;
orgs:=ContactDbCentralDM.OrganizationNumbersSL.Count;
PeopleByOrgsLV.Clear;
for i:= 0 to orgs - 1 do
begin
display_this_contact:=False;
if display_all then display_this_contact:=True
else if ContactDbCentralDM.IsActiveContactSL.Strings[i]='T'
then
display_this_contact:=True
else display_this_contact:=False;
if display_this_contact then begin
str:=ContactDbCentralDM.OrganizationNamesSL.Strings[i];
PeopleByOrgsLV.AddItem(str,nil);
str:=ContactDbCentralDM.PositionTitlesSL.Strings[i];
PeopleByOrgsLV.Items[i].SubItems.Add(str);
//compiler says no to the following line
PtrToContactNumber:=@ContactDbCentralDM.ContactNumbersSL.Strings[i];
PeopleByOrgsLV.Items[i].Data:=PtrToContactNumber;
end;
end;
I realise its probably that I am doing something dumb.
Technical Details
Message-ID:
<eb0078b1.0404070114.2522ecfd@posting.google.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109d30,80b82affef4afa46,start X-Google-Attributes: gid109d30,public X-Google-ArrivalTime: 2004-04-07 02:14:45 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail From: njj4cis@yahoo.co.uk (Neil Joyce) Newsgroups: borland.public.delphi.language.objectpascal Subject: Is this a valid use of @ Date: 7 Apr 2004 02:14:44 -0700 Organization: http://groups.google.com Lines: 41 Message-ID: <eb0078b1.0404070114.2522ecfd@posting.google.com> NNTP-Posting-Host: 195.195.255.18 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1081329284 30112 127.0.0.1 (7 Apr 2004 09:14:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 7 Apr 2004 09:14:44 +0000 (UTC)