Correct. This is the solution I also used.

thanks for al advice and l replies.

 

________________________________

Slide scanning / dia's scannen
           vanaf / from
              E0,08c
     www.scancare.nl     

________________________________






________________________________
From: Peter Luijer <[email protected]>
To: [email protected]
Sent: Wed, October 7, 2009 3:50:47 PM
Subject: RE: [delphi-en] Re: counting occurances of  unique words

   
Of course you first need to "assign the object" when you create the
list-item:

Procedure AddItem(AWord : String);
Begin
fStringList. Items.AddObject( AWord, TObject(1));
End;

After that you can simply increase it's value by using

Procedure IncreaseCount( AItemIndex : Integer);
Begin
fStringList. Objects[AItemInd ex] :=
TObject(Succ( Integer(fStringL ist.Objects[ AItemIndex] )));
End;

OR:

Procedure IncreaseCount( AItemIndex : Integer);
Var
I : Integer;
Begin
I := Integer(fStringList .Objects[ AItemIndex] );
I := I + 1;
fStringList. Objects[AItemInd ex] := TObject(I);
End;

Which does exactly the same, but uses *more* code ;-)

Greetz,

Peter.

-----Oorspronkelijk bericht-----
Van: delphi...@yahoogrou ps.com [mailto:delphi...@yahoogrou ps.com]Namens
David Smith
Verzonden: woensdag 7 oktober 2009 15:36
Aan: delphi...@yahoogrou ps.com
Onderwerp: Re: [delphi-en] Re: counting occurances of unique words

How'd you get it compile without declaring that integer variable? ;-)


   


      

[Non-text portions of this message have been removed]

Reply via email to