I would like to swap the SelectDir page with the Components page in my setup.
I found a solution where the content of the other page is assigned to the current page.
Procedure CurPageChanged(CurPageID: Integer);
Begin
Case CurPageID of
wpSelectDir:
begin
WizardForm.SelectDirPage.Notebook.ActivePage:= WizardForm.SelectComponentsPage;
WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectComponents)
WizardForm.Hint:= WizardForm.PageDescriptionLabel.Caption;
WizardForm.PageDescriptionLabel.Caption:= SetupMessage(msgSelectComponentsDesc)
end;
wpSelectComponents:
begin
WizardForm.SelectComponentsPage.Notebook.ActivePage:= WizardForm.SelectDirPage;
WizardForm.DiskSpaceLabel.Caption:= WzardForm.ComponentsDiskSpaceLabel.Caption;
WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectDir)
WizardForm.PageDescriptionLabel.Caption:= WizardForm.Hint
end;
end;
End;
The problem using this method is that only the content but not the actual page is changed. Message boxes and error messages are not affected. I wrote many lines of code to work around these problems but I encounter more and more problems...
Is there a better solution? I hope you can help me!
Edit: After experimenting a bit I came up with this:
procedure RedesignWizard;
var
Page: TWizardPage;
begin
Page := CreateCustomPage(wpWelcome, 'bla', 'bla');
WizardForm.ComponentsList.Parent := Page.Surface;
//Here I am changing the layout of the pages...
end;
procedure InitializeWizard;
begin
RedesignWizard;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if (CurPageID = Page.ID) then
begin
//perform your actions specific to the Custom page here.
end;
end;
This way the components list appears before the SelctDirPage and I do not have any more problems with those message boxes.
There is absolutely no way to safely swap the order of any of the builtin pages. (And usually, the only time people ask is when they are trying to replicate the flow of a different installation system. Relax and let it go; Inno works differently, embrace it instead of fighting it.)
Having said that, it is possible to give the appearance of swapping the pages, by recreating one or the other of them as a custom page. However by doing this you will forfeit all of the built-in functionality associated with that page -- eg. if you replace the components page then you cannot use the [Components] section or parameters, and if you replace the directory page then you cannot use {app} (not even in those places that use it implicitly, such as the UninstallFilesDir).
If you're willing to put in a lot of time and effort (especially testing), it can be done. But everything is worse off as a result -- so normally you're better off not doing so.