Hello,
how can i get the number of an existig Item?
I have...
RichView1.AddNL('MyFirstLine',0,0);
RichView1.Add('example',1);
RichView1.Format;
now i search the ItemNumber of "MyFirstLine" ?
Is it possible to get the ItemNumber?
best regrads, Frank
How to get the ItemNumber of an existing String?
-
- Posts: 14
- Joined: Fri Jan 20, 2006 11:05 am
- Location: Germany
-
- Site Admin
- Posts: 17534
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
The simplest way is to store item index at the moment of document generation:
or you can search for it:
Of course, this code returns the proper value only if there is no another text item with 'MyFirstLine' text.
Code: Select all
MyFirstLineItemNo := RichView1.ItemCount;
RichView1.AddNL('MyFirstLine',0,0);
RichView1.Add('example',1);
RichView1.Format;
Code: Select all
MyFirstLineItemNo := -1;
for i := 0 to RichView1.ItemCount-1 do
if RichView1.GetItemTextA(i)='MyFirstLine' then begin
MyFirstLineItemNo := i;
break;
end;
-
- Posts: 14
- Joined: Fri Jan 20, 2006 11:05 am
- Location: Germany
-
- Site Admin
- Posts: 17534
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: