trichview.com

trichview.support




Re: Getting the text of an item using TCustomRVItemInfo


Return to index


Author

Message

Martin Holmes

Posted: 07/06/2004 15:23:19


Hi Sergey,


Sergey Tkachenko wrote:


>>I'm still struggling to find a way to get the text. Perhaps I could

>>explain what I'm actually trying to do here. What I'm creating is a

>>footnote system, basically, and every time a footnote is inserted, I

>>need to find the number of the previous footnote so that I can determine

>>the appropriate number for the new one, and renumber any subsequent

>>ones. If there's a better way to do this, I'll be very glad to have it

>>pointed out to me, but at the moment all I can think of is to build an

>>index of items and move up and down the list, to find which ones have

>>the footnote style, then read or change their text (= footnote number).

>>I could store the footnote number in the tag for each item, but I'd

>>still have to display it in the text, and I'd still have to change it

>>for all subsequent footnotes, so I still have to be able to write the

>>text of the item.

>

>

> I understand, and I can give you a code to make this efficiently.

> What your footnote is? A special item type?


A footnote consists of three things:


1. Some text the user has chosen to associate with the footnote, by

selecting it before inserting the footnote. This is optional; if no text

is selected, it doesn't matter. The text is assigned a specific style

which includes underlining and a unique colour.


2. The footnote number. This is inserted into the text, and assigned its

own style (superscript, bold, and a unique colour).


3. The (WideString) footnote text, which is kept in a WideStringList (I

use Troy Wolbrink's Unicode libraries for WideString lists, controls and

other functions).


Because the footnote number style is only used for footnote numbers, I

was hoping that I could track and adjust footnote numbers in the text

just by iterating through the items and checking their style; when I

find something with the footnote number style, I know I have a footnote,

and if I can read its text too, I can get its number with StrToInt. I

have to handle embedded tables, though, so I wrote the code to build my

own list of pointers to items in the linear order they appear in the

text. I could also store the footnote number in the tag of the element,

but I would still have to change the number in the text when footnotes

are inserted or deleted.


Any suggestions you can offer would really be useful.


Cheers,

Martin





Powered by ABC Amber Outlook Express Converter