By Martin Prikryl

https://stackoverflow.com/questions/42625626/inno-setup-how-to-create-a-outernotebook-welcome-page-in-the-uninstaller

You create the page as any other, except that its parent will be the UninstallProgressForm.OuterNotebook, not the .InnerNotebook.

Tricky part is not how to create the page, but how to implement the Next/Back buttons.

The Next button on the "welcome" page must change the page of the OuterNotebook from the "welcome" page to the UninstallProgressForm.InnerPage. And of course make sure the active page on the .InnerNotebook is the first normal/inner page.

Conversely, the Back button on the first normal/inner page must change the page of the OuterNotebook from the UninstallProgressForm.InnerPage to the "welcome" page.

So modifying my answer to the Custom Uninstall page (not MsgBox) to cater for the above, you will get:

[Files]
Source: "compiler:WizModernImage-IS.bmp"; DestDir: {app} [Code] var
UninstallWelcomePage: TNewNotebookPage;
UninstallFirstPage: TNewNotebookPage;
UninstallSecondPage: TNewNotebookPage;
UninstallBackButton: TNewButton;
UninstallNextButton: TNewButton; procedure UpdateUninstallWizard;
begin
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallFirstPage then
begin
UninstallProgressForm.PageNameLabel.Caption := 'First uninstall wizard page';
UninstallProgressForm.PageDescriptionLabel.Caption :=
'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
end
else
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallSecondPage then
begin
UninstallProgressForm.PageNameLabel.Caption := 'Second uninstall wizard page';
UninstallProgressForm.PageDescriptionLabel.Caption :=
'Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
end; UninstallBackButton.Visible :=
(UninstallProgressForm.OuterNotebook.ActivePage <> UninstallWelcomePage); if UninstallProgressForm.InnerNotebook.ActivePage <> UninstallSecondPage then
begin
UninstallNextButton.Caption := SetupMessage(msgButtonNext);
UninstallNextButton.ModalResult := mrNone;
end
else
begin
UninstallNextButton.Caption := 'Uninstall';
{ Make the "Uninstall" button break the ShowModal loop }
UninstallNextButton.ModalResult := mrOK;
end;
end; procedure UninstallNextButtonClick(Sender: TObject);
begin
if UninstallProgressForm.OuterNotebook.ActivePage = UninstallWelcomePage then
begin
UninstallProgressForm.OuterNotebook.ActivePage := UninstallProgressForm.InnerPage;
UninstallProgressForm.InnerNotebook.ActivePage := UninstallFirstPage;
UpdateUninstallWizard;
end
else
begin
if UninstallProgressForm.InnerNotebook.ActivePage <> UninstallSecondPage then
begin
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallFirstPage then
begin
UninstallProgressForm.InnerNotebook.ActivePage := UninstallSecondPage;
end;
UpdateUninstallWizard;
end
else
begin
UninstallNextButton.Visible := False;
UninstallBackButton.Visible := False;
end;
end;
end; procedure UninstallBackButtonClick(Sender: TObject);
begin
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallFirstPage then
begin
UninstallProgressForm.OuterNotebook.ActivePage := UninstallWelcomePage;
end
else
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallSecondPage then
begin
UninstallProgressForm.InnerNotebook.ActivePage := UninstallFirstPage;
end; UpdateUninstallWizard;
end; procedure InitializeUninstallProgressForm();
var
PageText: TNewStaticText;
UninstallWizardBitmapImage: TBitmapImage;
PageNameLabel: string;
PageDescriptionLabel: string;
CancelButtonEnabled: Boolean;
CancelButtonModalResult: Integer;
begin
if not UninstallSilent then
begin
PageNameLabel := UninstallProgressForm.PageNameLabel.Caption;
PageDescriptionLabel := UninstallProgressForm.PageDescriptionLabel.Caption; { Create the Welcome page and make it active }
UninstallWelcomePage := TNewNotebookPage.Create(UninstallProgressForm);
UninstallWelcomePage.Notebook := UninstallProgressForm.OuterNotebook;
UninstallWelcomePage.Parent := UninstallProgressForm.OuterNotebook;
UninstallWelcomePage.Align := alClient;
UninstallWelcomePage.Color := clWindow; UninstallWizardBitmapImage := TBitmapImage.Create(UninstallProgressForm);
UninstallWizardBitmapImage.Parent := UninstallWelcomePage;
UninstallWizardBitmapImage.Width := ScaleX();
UninstallWizardBitmapImage.Height := ScaleX();
UninstallWizardBitmapImage.Bitmap.LoadFromFile(
ExpandConstant('{app}\WizModernImage-IS.bmp'));
UninstallWizardBitmapImage.Center := True;
UninstallWizardBitmapImage.Stretch := True; PageText := TNewStaticText.Create(UninstallProgressForm);
PageText.Parent := UninstallWelcomePage;
PageText.Left := ScaleX();
PageText.Top := ScaleX();
PageText.Width := ScaleX();
PageText.Height := ScaleX();
PageText.AutoSize := False;
PageText.Caption := 'Welcome to the My Program uninstall wizard';
PageText.ShowAccelChar := False;
PageText.WordWrap := True;
PageText.Font.Name := 'Verdana';
PageText.Font.Size := ;
PageText.Font.Style := [fsBold]; PageText := TNewStaticText.Create(UninstallProgressForm);
PageText.Parent := UninstallWelcomePage;
PageText.Left := ScaleX();
PageText.Top := ScaleX();
PageText.Width := ScaleX();
PageText.Height := ScaleX();
PageText.AutoSize := False;
PageText.Caption :=
'This will uninstall My Program 1.5 from your computer.'#### +
'It is recommended that your close all other applications before continuing.' +
#### +
'Click Next to continue, or Cancel to exit Uninstall.';
PageText.ShowAccelChar := False;
PageText.WordWrap := True; UninstallProgressForm.OuterNotebook.ActivePage := UninstallWelcomePage; { Create the first page }
UninstallFirstPage := TNewNotebookPage.Create(UninstallProgressForm);
UninstallFirstPage.Notebook := UninstallProgressForm.InnerNotebook;
UninstallFirstPage.Parent := UninstallProgressForm.InnerNotebook;
UninstallFirstPage.Align := alClient; PageText := TNewStaticText.Create(UninstallProgressForm);
PageText.Parent := UninstallFirstPage;
PageText.Top := UninstallProgressForm.StatusLabel.Top;
PageText.Left := UninstallProgressForm.StatusLabel.Left;
PageText.Width := UninstallProgressForm.StatusLabel.Width;
PageText.Height := UninstallProgressForm.StatusLabel.Height;
PageText.AutoSize := False;
PageText.ShowAccelChar := False;
PageText.Caption := 'Press Next to proceeed with uninstallation.'; { Create the second page }
UninstallSecondPage := TNewNotebookPage.Create(UninstallProgressForm);
UninstallSecondPage.Notebook := UninstallProgressForm.InnerNotebook;
UninstallSecondPage.Parent := UninstallProgressForm.InnerNotebook;
UninstallSecondPage.Align := alClient; PageText := TNewStaticText.Create(UninstallProgressForm);
PageText.Parent := UninstallSecondPage;
PageText.Top := UninstallProgressForm.StatusLabel.Top;
PageText.Left := UninstallProgressForm.StatusLabel.Left;
PageText.Width := UninstallProgressForm.StatusLabel.Width;
PageText.Height := UninstallProgressForm.StatusLabel.Height;
PageText.AutoSize := False;
PageText.ShowAccelChar := False;
PageText.Caption := 'Press Uninstall to proceeed with uninstallation.'; UninstallNextButton := TNewButton.Create(UninstallProgressForm);
UninstallNextButton.Parent := UninstallProgressForm;
UninstallNextButton.Left :=
UninstallProgressForm.CancelButton.Left -
UninstallProgressForm.CancelButton.Width -
ScaleX();
UninstallNextButton.Top := UninstallProgressForm.CancelButton.Top;
UninstallNextButton.Width := UninstallProgressForm.CancelButton.Width;
UninstallNextButton.Height := UninstallProgressForm.CancelButton.Height;
UninstallNextButton.OnClick := @UninstallNextButtonClick; UninstallBackButton := TNewButton.Create(UninstallProgressForm);
UninstallBackButton.Parent := UninstallProgressForm;
UninstallBackButton.Left :=
UninstallNextButton.Left - UninstallNextButton.Width - ScaleX();
UninstallBackButton.Top := UninstallProgressForm.CancelButton.Top;
UninstallBackButton.Width := UninstallProgressForm.CancelButton.Width;
UninstallBackButton.Height := UninstallProgressForm.CancelButton.Height;
UninstallBackButton.Caption := SetupMessage(msgButtonBack);
UninstallBackButton.OnClick := @UninstallBackButtonClick;
UninstallBackButton.TabOrder := UninstallProgressForm.CancelButton.TabOrder; UninstallNextButton.TabOrder := UninstallBackButton.TabOrder + ; UninstallProgressForm.CancelButton.TabOrder := UninstallNextButton.TabOrder + ; { Run our wizard pages }
UpdateUninstallWizard;
CancelButtonEnabled := UninstallProgressForm.CancelButton.Enabled
UninstallProgressForm.CancelButton.Enabled := True;
CancelButtonModalResult := UninstallProgressForm.CancelButton.ModalResult;
UninstallProgressForm.CancelButton.ModalResult := mrCancel; if UninstallProgressForm.ShowModal = mrCancel then Abort; { Restore the standard page payout }
UninstallProgressForm.CancelButton.Enabled := CancelButtonEnabled;
UninstallProgressForm.CancelButton.ModalResult := CancelButtonModalResult; UninstallProgressForm.PageNameLabel.Caption := PageNameLabel;
UninstallProgressForm.PageDescriptionLabel.Caption := PageDescriptionLabel; UninstallProgressForm.InnerNotebook.ActivePage :=
UninstallProgressForm.InstallingPage;
end;
end;

Note that there's no way to use the built-in images from the installer in the uninstaller. In my simple code above, I install the "welcome" page image to the {app} and load it from there.

If you want to avoid this, see my answer to the How keep uninstall files inside uninstaller?

最新文章

  1. Javascript 事件对象进阶(二)拖拽的应用 - 登录框的拖拽
  2. JSON字符串如何转化成对象?
  3. extjs4与ckeditor、ckfinder整合
  4. [百度空间] [原]android下的各种坑
  5. ARM CPU与Intel x86 CPU性能比较
  6. HDU 5430 Reflect
  7. 《C和指针》读书笔记——第二章 基本概念
  8. 【二分+最大团】【HDU3585】【maximum shortest distance】
  9. java线程管理
  10. Python 实现类似PHP的strip_tags功能,并能够定义他们自己的一套保留标记
  11. AngularJS中如果ng-src 图片加载失败怎么办
  12. .Net异步编程知多少
  13. 数组a[n]中存放1-n中的n-1个数,给出算法找出重复的那一个数
  14. Java 常见摘要算法——md5、sha1、sha256
  15. 使用.gitignore删除Github上的.idea文件
  16. canvas(一) 基本线条绘制
  17. 【ASP.NET 进阶】Flv视频文件在线播放示例
  18. 使用STM32的USART的同步模式Synchronous调戏SPI【usart模拟spi理论】
  19. 吴裕雄 python 机器学习-DMT(2)
  20. HTTP协议图--概述

热门文章

  1. Java系列之数组
  2. Django-on_delete
  3. D - 淡黄的长裙 HDU - 4221(贪心)
  4. 《Three.js 入门指南》3.0 - 代码构建的最基本结构。
  5. docker下搭建nginx
  6. 1021 Deepest Root (25 分)
  7. Spring MVC 笔记--配置基于JavaConfig
  8. node.js模拟学校教务处登录
  9. 个人博客如何申请ICP备案
  10. nginx产品环境安全配置-主配置文件