1

I'm using code from How to add clickable links to custom Inno Setup WelcomeLabel?:

procedure InitializeWizard;
var
  RichViewer: TRichEditViewer;
begin
  RichViewer := TRichEditViewer.Create(WizardForm);
  RichViewer.Left := WizardForm.WelcomeLabel2.Left;
  RichViewer.Top := WizardForm.WelcomeLabel2.Top;
  RichViewer.Width := WizardForm.WelcomeLabel2.Width;
  RichViewer.Height := WizardForm.WelcomeLabel2.Height;
  RichViewer.Parent := WizardForm.WelcomeLabel2.Parent;
  RichViewer.BorderStyle := bsNone;
  RichViewer.TabStop := False;
  RichViewer.ReadOnly := True;
  WizardForm.WelcomeLabel2.Visible := False;

  RichViewer.RTFText :=
    '{\rtf1 Lorem ipsum dolor sit amet ' +
    '{\b {\field{\*\fldinst{HYPERLINK "https://www.example.com/" }}' +
    '{\fldrslt{CLICK_HERE}}}} ' +
    'consectetur adipiscing elit.}';
end;

And I want to change the color of the hyperlink to blue:

enter image description here

How do I use a syntax for changing changing hyperlink color in RTF from the answer by Oliver Bock to What is the RTF syntax for a hyperlink? with the above code?

{\colortbl ;\red0\green0\blue238;}
{\field{\*\fldinst HYPERLINK "URL"}{\fldrslt{\ul\cf1Text to display}}}
Community
  • 1
  • 1
Nico Z
  • 837
  • 8
  • 26

1 Answers1

2

Indeed, on Windows 7, the link color is not blue by default (it is on Windows 10).

The correct RTF syntax to force a certain link color is like:

RichViewer.RTFText :=
  '{\rtf1 ' +
  '{\colortbl ;\red238\green0\blue0;}' +
  'Lorem ipsum dolor sit amet ' +
  '{\b {\field{\*\fldinst{HYPERLINK "https://www.example.com/" }}' + 
  '{\fldrslt{\cf1 CLICK_HERE\cf0 }}}} ' +
  'consectetur adipiscing elit.}';

Red link on Windows 7 Red link on Windows 10

Martin Prikryl
  • 167,268
  • 50
  • 405
  • 846
  • Martin, i am trying to localized this code but is very complicated for me (i am trying to use the answer of http://stackoverflow.com/questions/41153301/inno-setup-how-to-display-localized-rtf-text-in-custom-page But it is not the same case). How can i do this? Thanks. – Nico Z Feb 16 '17 at 21:17
  • 1
    What do you want to localize? You can either localize the individual pieces (1. "Lorem ipsum dolor sit amet", 2. "CLICK_HERE", 3. "consectetur adipiscing elit.") and then assemble them in the code. Or you can put whole RTF string to the messages. – Martin Prikryl Feb 17 '17 at 07:52
  • `'{\fldrslt{\cf1 ' + CustomMessage('Game') + '\cf0 }}}} '` + And of course, you cannot use the same custom message for all pieces, it does not make sense. – Martin Prikryl Feb 17 '17 at 11:03
  • 1
    `CustomMessage('Game') + '}';` – Martin Prikryl Feb 17 '17 at 11:22