Search code examples
inno-setup

Display a message in separate window visible throughout an installation


I already used InfoBeforeFile directive, with an "Important notice" text file.

But I would prefer the user could continue to read the instructions throughout an installation (e.g. in a separate window).

Any clue?


Added the final result, thanks again to Martin Prikryl

added the final result


Solution

  • Use CreateCustomForm function to create a separate window for your message.

    [Files]
    Source: "important.txt"; Flags: dontcopy;
    
    [Code]
    
    procedure InitializeWizard();
    var
      InfoForm: TSetupForm;
      InfoMemo: TRichEditViewer;
    begin
      InfoForm := CreateCustomForm;
      Log(IntToStr(WizardForm.Left));
      Log(IntToStr(WizardForm.Width));
      InfoForm.Left := WizardForm.Left + WizardForm.Width; 
    
      InfoForm.Width := ScaleX(400); 
      InfoForm.Caption := 'Important message';
      InfoForm.Top := WizardForm.Top;
      InfoForm.Height := WizardForm.Height;
      InfoForm.Position := poDesigned;
      InfoForm.Show();
    
      InfoMemo := TRichEditViewer.Create(InfoForm);
      InfoMemo.Parent := InfoForm;
      InfoMemo.Left := ScaleX(40);
      InfoMemo.Top := ScaleX(40);
      InfoMemo.Width := InfoForm.ClientWidth - 2 * ScaleX(40);
      InfoMemo.Height := InfoForm.ClientHeight - 2 * ScaleX(40);
      InfoMemo.ScrollBars := ssVertical;
      InfoMemo.ReadOnly := ssVertical;
      InfoMemo.WantReturns := ssVertical;
      InfoMemo.WantReturns := False;
    
      ExtractTemporaryFile('important.txt');
      InfoMemo.Lines.LoadFromFile(ExpandConstant('{tmp}\important.txt'));
    end;
    

    enter image description here


    Though, wouldn't it be better to display the message on the side of the installer wizard?