Search code examples
inno-setuppascalscript

Inno Setup: TInputOptionWizardPage disabled radio buttons look partially enabled (bug?)


I have a custom page in my Inno Setup script that I create by doing the following:

var    
  installSelectPage: TInputOptionWizardPage;
  { ... }

procedure InitializeWizard;
begin
  installSelectPage :=
    CreateInputOptionPage(wpInfoBefore,
     'Select Destination Location', 'Where should {#MyAppName} be installed?',
     'Please select which {#MyGameName} distribution you want to mod',
     True, False);

  radioIndex_retailInstall := installSelectPage.Add('Retail/DVD');
  radioIndex_steamInstall := installSelectPage.Add('Steam');
  radioIndex_manualInstall := installSelectPage.Add('Manual Directory Selection')

Then at some point later in the InitializeWizard procedure I read some registry keys and disable the radio buttons who's respective keys aren't found:

  if not(retailInstallAvailable) then
    installSelectPage.CheckListBox.ItemEnabled[radioIndex_retailInstall] := False;

  if not(steamInstallAvailable) then
    installSelectPage.CheckListBox.ItemEnabled[radioIndex_steamInstall] := False;

This mostly works, but there's some odd error with the appearance of the buttons. While testing this on a machine where both the first and second button are disabled (the third never is), when I first arrive at this custom page if none of the options are select they look like this:

Bugged 'disable style' buttons

It's subtle, but if you look closely you will notice how the first two radio buttons (not their text) still look partially enabled (and to varying degrees!).

If I then select the third option (only one available on this machine), hit back and then next again to refresh the page the buttons then look correct:

Correct'disable style' buttons

Does anyone know what the heck Inno Setup is doing and how I can get the buttons to look fully disabled while none of the buttons are selected?


Solution

  • I can reproduce the problem.

    It seems to happen when the focused item is disabled. The focused item is by default the first one. Make sure you set ItemIndex to the index of an (first) enabled item.

    installSelectPage.CheckListBox.ItemIndex := ...;