Recent

Author Topic: ATSynEdit and URL Highlighter [solved]  (Read 1945 times)

six1

  • Full Member
  • ***
  • Posts: 110
ATSynEdit and URL Highlighter [solved]
« on: November 27, 2021, 11:17:31 am »
Hi,
if I assign a text, including an URL to an ATSynEdit, the URL is displayed in blue color. So far OK.
If I now assign a text without an URL, the previous highlight position will still be retained.

Am I doing something wrong or is there an error in ATSynEdit?

Here is a sample, that shows the "error".
First click the "Set URL Text" button, then the "Set Text Lines" button

« Last Edit: November 27, 2021, 12:15:05 pm by six1 »

AlexTP

  • Hero Member
  • *****
  • Posts: 1846
    • UVviewsoft
Re: ATSynEdit and URL Highlighter
« Reply #1 on: November 27, 2021, 11:57:06 am »
Thanks for note. I just fixed the .SetText method to:
Code: Pascal  [Select][+][-]
  1. procedure TATSynEdit.SetText(const AValue: UnicodeString);
  2. begin
  3.   Strings.LoadFromString(UTF8Encode(AValue));
  4.  
  5.   DoCaretSingle(0, 0);
  6.   if Assigned(FMarkers) then
  7.     FMarkers.Clear;
  8.   if Assigned(FAttribs) then
  9.     FAttribs.Clear;
  10.   if Assigned(FLinkCache) then
  11.     FLinkCache.Clear;
  12.  
  13.   Update(true);
  14. end;  
  15.  
« Last Edit: November 27, 2021, 11:58:57 am by Alextp »

six1

  • Full Member
  • ***
  • Posts: 110
Re: ATSynEdit and URL Highlighter
« Reply #2 on: November 27, 2021, 12:09:39 pm »
thanks in advance Alex!
That answer was realy quick  :)

 

TinyPortal © 2005-2018