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

人走茶凉 提交于 2020-04-06 23:22:12

问题


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:

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

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


回答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).



来源:https://stackoverflow.com/questions/60901834/how-to-add-clickable-links-to-custom-page-in-inno-setup-using-richeditviewer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!