Page 1 of 1

An idea for footnote-handling: will this work?

Posted: Mon Mar 13, 2006 1:45 pm
by martindholmes
Hi there,

In my eternal quest to find a good way to handle footnotes in TRichViewEdit, I have an idea I'd like to run by you:

Do you think it would be practical to store formatted text, created in a separate TRichViewEdit control, in the PChar strings associated with an item in another TRichViewEdit? Here's what I imagine:

In the main edit control, the user inserts a footnote. In another TRichViewEdit which pops up, the user then writes and formats the footnote text. Then I stream out this text in RVF to a string stream, and store the string as a PChar tag (rvoTagsArePChars) in the main TRichViewEdit. When I need to show the comment again, I stream out the contents of the tag into the footnote editing control.

Does this sound like a practical approach? I'm working with Unicode text.

Cheers,
Martin

Posted: Mon Mar 13, 2006 4:08 pm
by Sergey Tkachenko
I think it's better to store some unique footnote identifier in tag, and maintain a database of footnotes (two fields: identifier and formatted text)

Posted: Tue Mar 14, 2006 1:22 pm
by martindholmes
Hi there,

I'm interested to know why you think so. If I store the data in the PChar tag, I only have to store one set of data, and I don't have to track identifiers externally. If I use an identifier and a separate data structure, there's more work to do, and I risk the two getting out of sync.

Is there any technical objection to storing RVF in a PChar tag?

Cheers,
Martin

Posted: Tue Mar 14, 2006 2:12 pm
by Sergey Tkachenko
RVF may contain line breaks and #0 characters, they are not allowed in tag strings.
Well, storing RVF in tags is actually more simple, but you need to encode it somehow to eliminate these characters.