trichview.com

trichview.support




Re: How to get the last item in a paragraph


Return to index


Author

Message

Sergey Tkachenko

Posted: 11/05/2003 21:22:24


> Hi,

> After finding the start of a paragraph by issuing the command:

>      if isParaStart(i) then....


Last item in the paragraph is either

- the last item before the next paragraph (IsParaStart is true for the first

item of the next paragraph, and the last item of this paragraph is the

previous item)

or

- the last document item (ItemCount-1), if this is a last paragraph


> how can I find the last item in THE specific paragraph?


For example, in the paragraph started from FirstItemNo:


LastItemNo := FirstItemNo;

while (LastItemNo+1<rv.ItemCount) and not rv.IsParaStart(LastItemNo+1) do

  inc(LastItemNo);



> > The second question is:

> If I have inserted empty item using := AppendText('',1,0); How can I

delete

> the items. It seems that if I use DeleteLines(x) it sometimes get

listindex

> out of bound. Empty items are not shown?


You must call Format after calling DeleteItems (and ClearUndo, because this

operation damages undo/redo buffers).

(DeleteLines is an old name of DeleteItems; if you use old version of the

component, please update).

You must be careful when using DeleteItems.

Please read "Valid Documents" topic in the help file.

There is alternative way to delete items: select them (SetSelectionBounds)

and call DeleteSelection. This operation can be undone/redone.


>

> If I have inserted empty text items, how do I delete them and get

richviewedit

> to re-arrange them so that the items are sequentially

arranged(1,2,3.....)?


Sorry, I do not understand this question. Items are always indexed from 0 to

ItemCount-1.






Powered by ABC Amber Outlook Express Converter