trichview.com

trichview.support




Re: Deleting an item safely (2)


Return to index


Author

Message

Martin Holmes

Posted: 08/19/2004 15:21:57


Hi Sergey,


The problem is that the cursor is not necessarily anywhere near the item

I'm trying to delete. I have a pointer to the item, a pointer to its

parent RVData, and its item number within its parent RVData. However, I

don't know whether this particular item is inside a table cell or not.

As far as I understand it, rve.TopLevelEditor will return the editor

containing the caret.


A little background: I'm still working on footnotes, and making a lot of

progress. I've succeeded in writing all the insertion code (finding

which footnote number is being inserted, renumbering subsequent

footnotes, etc.), and I'm now working on deleting a footnote. The issue

is that in my app, the user will be able to read footnote contents in a

list, and may elect to delete a footnote without reference to where it

happens to be in the text. I have to then find the footnote number in

the text (which I can do), delete it (the difficult bit), and then

renumber any subsequent footnotes (no problem). By iterating through all

the items in the document recursively, I have a list of them in order,

and I've stored a pointer to the item (TRVCustomItemInfo), its item

number, and its parent TCustomRVData. I can do a lot with this, but I

don't seem to be able to delete the item safely.


Cheers,

Martin


Sergey Tkachenko wrote:

> You need to initialize cell editing (table.EditCell or Cell.Edit), then use

> rve.TopLevelEditor instead of rve.

> rve.TopLevelEditor will contain cell items, indexed from 0.

>

>

>

>>In your previous answer, you suggested this code:

>>

>>   rve.SetSelectionBounds(ItemNo, rve.GetOffsBeforeItem(ItemNo),

>>     ItemNo, rve.GetOffsAfterItem(ItemNo));

>>   rve.DeleteSelection;

>>

>>What would I do if the item is inside a table? Is the item number unique

>>to this item in the whole document, or does each embedded TRichViewEdit

>>have a list of items starting from 0?

>>

>>Cheers,

>>Martin

>

>

>





Powered by ABC Amber Outlook Express Converter