我在Inno Setup脚本中有一个自定义页面,我通过执行以下操作创建该脚本:
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')
然后在InitializeWizard
程序的某个时候,我读了一些注册表项并禁用了找不到相应键的单选按钮:
if not(retailInstallAvailable) then
installSelectPage.CheckListBox.ItemEnabled[radioIndex_retailInstall] := False;
if not(steamInstallAvailable) then
installSelectPage.CheckListBox.ItemEnabled[radioIndex_steamInstall] := False;
这大部分都有效,但按钮的外观有一些奇怪的错误。在第一个和第二个按钮都被禁用的机器上测试时(第三个从不是),当我第一次到达这个自定义页面时如果没有选择它们,它们看起来像这样:
这很微妙,但如果你仔细观察,你会注意到前两个单选按钮(不是它们的文本)仍然看起来部分启用(并且在不同程度上!)。
如果我然后选择第三个选项(此机器上只有一个选项),请回击然后再次按下以刷新页面按钮然后看起来正确:
有没有人知道Inno Setup正在做什么以及如何在没有选择任何按钮的情况下让按钮看起来完全禁用?
我可以重现这个问题。
当焦点项被禁用时,似乎会发生这种情况。默认情况下,焦点项目是第一个。确保将ItemIndex
设置为(第一个)启用项的索引。
installSelectPage.CheckListBox.ItemIndex := ...;