9

Is there a way to disable the "Next" button on the Inno Setup's wizard form ?

TLama
  • 75,147
  • 17
  • 214
  • 392
Sasha
  • 1,958
  • 1
  • 19
  • 33

3 Answers3

10

This should work:

Wizardform.NextButton.Enabled := False;

For more information check out the InnoSetup newsgroups:
http://www.jrsoftware.org/newsgroups.php

Yvo
  • 18,681
  • 11
  • 71
  • 90
  • In what kind of event are you using it? CurPageChanged? – Yvo Feb 07 '10 at 23:15
  • I use it in Event Handler of my custom button. I want to disable 'Next' button thus the user can not click on it. – Sasha Feb 08 '10 at 07:44
  • Could you post some of the InnoSetup script in your start post? The code should work, but it depends on where you place it. Now it might simply not be called or called to late in the process. – Yvo Feb 08 '10 at 09:19
  • Thank you! It works! The problem was that after setting "Enabled" to "False", I used TOutputProgressWizardPage and it changed the state of Next button. – Sasha Feb 08 '10 at 10:53
4

I guess you have found a workaround by now. Since I had the same problem and found the solution, I am posting it here in hope of helping others.

I wanted to disable the CANCEL button after a user began an application upgrade. Use this procedure:

procedure CurPageChanged(CurPageID: Integer);
begin
  // always disable the cancel button; no going back now!!!
  if UpgradeInstallationMode then
    Wizardform.CancelButton.Enabled := False;
end;

Also another way of manually doing this is:

procedure DisableCancelButton();
begin
  WizardForm.CancelButton.Enabled := False;
  WizardForm.Update;
end;

procedure EnableCancelButton();
begin
  WizardForm.CancelButton.Enabled := True;
  WizardForm.Update;
end;

Another way would be to use this [Setup] directive:

[Setup]
AllowCancelDuringInstall=yes

This is very useful for simple scenarios; you may use this instead of the above procedures.

fubar
  • 338
  • 1
  • 6
  • 20
  • 1
    I'd say that forcing the `WizardForm` to repaint itself (that `WizardForm.Update` line) is not necessary, and even though you've answered how to disable Cancel button, I'm giving you my upvote. – TLama Oct 18 '13 at 14:40
  • yeah, you are probably right; it's just an **overkill**! Sometimes I just use **double tap** to be sure! Java Swing repaint() still haunts me, I guess... Still, if you want to use this outside `CurPageChanged()`, you have to `WizardForm.Update;` or else the button won't refresh. – fubar Oct 20 '13 at 20:17
0

Sorry about not being able to help in your particular problem directly. I would like to point out though that Inno Setup does not seem to be based on Windows Installer, which will probably make sure that your programs cannot pass Windows Logo requirements.

I would suggest that you take a look at WiX 3, which is an open source installer creator directly from Microsoft, with excellent support from the many people using it and that allows you to easily create regular Windows Installer packages. Disabling the Next button is easy using Wix.

villintehaspam
  • 8,540
  • 6
  • 45
  • 76