I am VERY new to WP Tools... I hope someone can help.
Delphi 7 is my dev env.
I am replacing another RichText component with WPT. I have a set of very non-standard tokens that I have to replace after opening a file and before display.
The Tokens are lead-in and lead-out. For example: ~FGR~ Hello World ~FGE~ is ot be displayed as " Hello World " in Red font colour.
Q.: Is that a simple method with WPT similar to ReplaceTokens that will allow me to:
(i) process the token replace one at a time,
(ii) return as SelText all characters between the tokens and then
(iii) allow me to change the attributes for the selected SelText
One other Q: How would I change he attribute of SelText to display as Superscript / Subscript?
The solution with Finder and TWPCustomRtfEdit.SelectedTextAttr I would also have suggested.
Note you can use a wildcard to modify all tokens at once
Finder.WildCard := '*'
while Finder.Next('~*~') do
begin
if FoundText = ... then FoundText := ...
FoundAttr.SetColor( .. )
end;
Please also note the method ReplaceTokens, text such as ~FGR~ could be converted into mail merge fields that way. ReplaceTokens also uses the finder internally.
#3♥ 0
This category is archived. No new posts are possible.