0

I made a custom wizard page, and I want it to show a sort of installation checklist at the end of the install, showing what installed successfully or not.

Something like

Crucial Step......................SUCCESS
Optional Step.....................FAILURE

So I have this code in my initializeWizard()

Page := CreateCustomPage(wpInstalling, 'Installation Checklist', 'Status of all installation components');

RichEditViewer := TRichEditViewer.Create(Page);
RichEditViewer.Width := Page.SurfaceWidth;
RichEditViewer.Height := Page.SurfaceHeight;
RichEditViewer.Parent := Page.Surface;
RichEditViewer.ScrollBars := ssVertical;
RichEditViewer.UseRichEdit := True;
RichEditViewer.RTFText := ''// I want this attribute to be set in CurStepChanged()

Is there a way to add or edit RichEditViewer.RTFText at a later point in time? Page is a global variable but trying to access any attributes gives me an error. I'd like to do edit the text after wpInstalling, so I can tell whether or not install steps were successful.

Nils Guillermin
  • 1,867
  • 3
  • 21
  • 51

1 Answers1

1

I'm not a huge fan of this method, but you Can set your RichEditViewer as a global, and then editing it at any point, in any function, is trivial.

var
  RichEditViewer: TRichEditViewer;

procedure InitializeWizard();
var
  Page: TWizardPage;
begin
  Page := CreateCustomPage(wpInstalling, 'Installation Checklist', '');

  RichEditViewer := TRichEditViewer.Create(Page);
  RichEditViewer.Width := Page.SurfaceWidth;
  RichEditViewer.Height := Page.SurfaceHeight;
  RichEditViewer.Parent := Page.Surface;
  RichEditViewer.ScrollBars := ssVertical;
  RichEditViewer.UseRichEdit := True;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep=ssPostInstall then RichEditViewer.RTFText := 'STUFF';
end;

Worthwhile to note, the page itself doesn't even need to be global.

Nils Guillermin
  • 1,867
  • 3
  • 21
  • 51
  • 1
    I do not understand what problem you have with this method. It's by far the best way. The only other is to lookup a child of the `Page` using `FindComponent` method or by iterating the `Controls` list. – Martin Prikryl Sep 29 '16 at 06:14
  • 1
    Just a personal aversion to global variables. – Nils Guillermin Sep 30 '16 at 11:10
  • 1
    We discussed this already: [Reading values from custom wizard pages without using global variables](http://stackoverflow.com/q/38792593/850848). – Martin Prikryl Sep 30 '16 at 11:17
  • 1
    Again, in Inno Setup you implement application hooks. Its API does not offer you any other way, except for global variables, for preserving a state. – Martin Prikryl Sep 30 '16 at 11:19