Page 1 of 1
InsertStringTag causes an exception in ActiveEditor
Posted: Tue Jul 24, 2012 1:41 pm
by vit
Why this code causes an exception?
Code: Select all
SRVE.ActiveEditor.InsertStringTag('111', 1);
SRVE.ActiveEditor.InsertStringTag('222', 2);
P.S. SRVE.ActiveEditor = SRVE.RichViewEdit
Posted: Tue Jul 24, 2012 2:12 pm
by vit
in case of SRVE.ActiveEditor it causes the exception too. But it works for TRichViewEdit.
In the TCustomRichViewEdit.InsertStringTag, InsertStringATag, InsertStringWTag subject of the TRichView Reference is written: Do not overuse these methods. Use InsertText when possible.
But InsertText doesn't insert text with tag.
Posted: Tue Jul 24, 2012 5:58 pm
by Sergey Tkachenko
1) You use an old version of our components. In the new version, item tags are strings, so problems like this are not possible.
Please consider upgrading.
In the new version, this code would be:
Code: Select all
SRVE.ActiveEditor.InsertStringTag('111', '1');
SRVE.ActiveEditor.InsertStringTag('222', '2');
2) (in old versions) if rvoTagsArePChars is included in Options, item tags are treated as pointers to strings (allocated using StrNew functions). In TSRichViewEdit, this option is included by default. Since values 1 and 2 are not pointers, it leads to an exception.
Either exclude rvoTagsArePChars from SRVE.RichViewEdit.Options(.RVHeader.Options, .RVFooter.Options) (and you will not be able using hyperlinks), or change your code to
Code: Select all
SRVE.ActiveEditor.InsertStringTag('111', Integer(StrNew('1')));
SRVE.ActiveEditor.InsertStringTag('222', Integer(StrNew('2'))));
Posted: Tue Jul 24, 2012 6:05 pm
by vit
Thank you!
InsertStringTag
Posted: Thu May 09, 2013 2:28 am
by mb123
Sergio, Please help.
I the old rich view I used:
ReplaceText: string;
ShipperTrackingNbr: String;
DBRichViewEdit1.InsertStringTag(ShipperTrackingNbr , Integer(StrNew(PChar(ReplaceText)));
Now it fails with
The DBRichViewEdit1ReadHyperlink method referenced by DBARichViewEdit1.OnReadHyperlink has an incompatible parameter list. Remove the reference?
Please advise.
Posted: Thu May 09, 2013 12:44 pm
by Sergey Tkachenko
See the list of compatibility issues in the help file:
http://www.trichview.com/help/new_in_version_14.html
Tags are strings now, not integers.
So this line must be changed to:
Code: Select all
DBRichViewEdit1.InsertStringTag(ShipperTrackingNbr , ReplaceText);
Also, a declaration of events having tags as parameters are changed (OnReadHyperlink, OnRVControlNeeded). In existing projects, you need to change declarations of handlers of these events manually.
New parameters:
http://www.trichview.com/help/idh_trich ... rlink.html