Changing hyperlink tag issue
Posted: Tue Jun 24, 2025 6:45 pm
Using the eval version under Delphi 12.3
I have this RTF hyperlink in a TRichViewEdit after loading an RTF file:
Within the hyperlink there is a bold word "red", which seems to divide the hyperlink into several text items within the field. If I click on either "red" or "line" and attempt to update the tag, it actually inserts a new hyperlink field. For example, I use the onclick event and do this:
I end up with this RTF after clicking on the word "line":
I wanted to just update the original Hyperlink field tag, and not insert a new hyperlink field. I assume this is because GetCurrentTag is operating on the item's outer field, and SetCurrentTag is operating on the current text item "line", so it makes it a hyperlink for some reason.
I'm not sure how to get around this. I've also tried using GetCurrentItem and updating the tag that way, but the same thing occurs. Help?
Eric
I have this RTF hyperlink in a TRichViewEdit after loading an RTF file:
Code: Select all
{\field{\*\fldinst{HYPERLINK "$noprint:\{1\}"}}{\*\fldtitle{$noprint:\{1\}}}
{\fldrslt{\f0\cf1 pre-cloaked\f0\cf0 \f0\cf1\b red\f0\cf1\b0 line\f0\cf0}}}
Code: Select all
var vTag := String(RichViewEdit1.GetCurrentTag);
if vTag.StartsWith('$noprint:{0}', true) then
RichViewEdit1.SetCurrentTag(ReplaceStr(vTag, '{0}', '{1}'))
else if vTag.StartsWith('$noprint:{1}', true) then
RichViewEdit1.SetCurrentTag(ReplaceStr(vTag, '{1}', '{0}'));
Code: Select all
{\field{\*\fldinst HYPERLINK "$noprint:\{1\}"}
{\fldrslt \plain \f0\fs20\cf11 pre-cloaked\plain \f0\fs20 \plain \f0\b\fs20\cf11 red}}
{\field{\*\fldinst HYPERLINK "$noprint:\{0\}"}{\fldrslt \plain \f0\fs20\cf11 line}}
I'm not sure how to get around this. I've also tried using GetCurrentItem and updating the tag that way, but the same thing occurs. Help?
Eric