Search code examples
inno-setuppascalscript

Inno Setup 'Close' button in titlebar doesn't work when 'Cancel' button is not visible


I removed Cancel button this way:

procedure CurPageChanged(CurPageID: Integer);
begin
  WizardForm.CancelButton.Visible := False;
end

But it also broke the close functionality of installer - 'Close' button in titlebar does not work and installer doesn't react to Alt+F4 keys. I know, there is AllowCancelDuringInstall=no directive, but it doesn't work either. Is it possible to hide Cancel button preserving ability to close the installer?


Solution

  • Indeed, ability to close the installer is linked to state of the Cancel button. It makes sense, right?

    Anyway, if you really want this strange setup, you can achieve it by moving the Cancel button out of the view and preventing it from receiving focus using the Tab key.

    procedure InitializeWizard();
    begin
      WizardForm.CancelButton.Left := ScaleX(-100);
      WizardForm.CancelButton.TabStop := False;
    end;