How to add clickable links to custom page in Inno Setup using RichEditViewer?
Asked Answered
I

1

2

How to add clickable link to RichEditViewer in Inno Setup? I tried this solution How to add clickable links to custom Inno Setup WelcomeLabel?

Using this code below:

[Code]

var
  Page: TWizardPage;

procedure CreateTheWizardPages;
var
  RichViewer1 : TRichEditViewer;
begin
  Page := CreateCustomPage(wpReady, 'Custom', 'Page');

  RichViewer1 := TRichEditViewer.Create(Page);
  RichViewer1.Left := 0;
  RichViewer1.Top := 30;
  RichViewer1.width:=400;
  RichViewer1.WordWrap := True;
  RichViewer1.BorderStyle := bsNone;
  RichViewer1.TabStop := False;
  RichViewer1.ReadOnly := True;
  RichViewer1.Parent := Page.Surface;
  RichViewer1.ParentColor := true; 
  RichViewer1.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.}';
end;

procedure InitializeWizard();
begin 
  CreateTheWizardPages;
end;

I got something like this on the custom page:

image

I would like to have ony one clickable link "CLICK_HERE"

I'm using Inno Setup 5.6.1, Windows 10 Pro 1909.

Involucel answered 28/3, 2020 at 13:34 Comment(0)
S
1

I've tested the code against various versions of Inno Setup compiler.

It looks like it does not work in Ansi version. It works in Unicode version. Unicode version is built using a newer version of Delphi, that's probably the reason.

You should switch to Unicode in any case. And once you do that, you should upgrade to the latest version of Inno Setup (which has the Unicode version only).

Stebbins answered 28/3, 2020 at 18:33 Comment(1)
yes, just installed 5.x version but Unicode :) and works. thank you. !Involucel

© 2022 - 2024 — McMap. All rights reserved.