本文介绍了Inno Setup:在运行时隐藏/禁用组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在运行时禁用或隐藏组件选择之一.我创建了一个带有两个单选按钮的自定义向导页面.如果选择了第一个单选按钮,则我希望其中一个组件(CustomInstall)不出现或至少被禁用.

当然,自定义页面出现在组件"页面之前.

我尝试使用Check:参数执行此操作,但是似乎[Components]部分是在启动时进行评估的,而不是在显示页面时进行评估.

所以我的下一个想法是向我的CurPageChanged()添加一些代码,以便可以从CheckListBox中删除或禁用该项目(我认为这称为ComopnentsList),但是在TNewCheckListBox上找不到任何文档. /p>

有人对这门课有更多了解吗?我在想什么会起作用吗?

解决方案

这就是我最终要做的事情:

if CurPageID=wpSelectComponents then
begin
  if ExtraOptionAvailable() then
  begin
    Wizardform.ComponentsList.Checked[6] := true;
    Wizardform.ComponentsList.ItemEnabled[6] := true;
  end else begin
    Wizardform.ComponentsList.Checked[6] := false;
    Wizardform.ComponentsList.ItemEnabled[6] := false;
  end;
end;

http://www.jrsoftware.org/newsgroups.php 上搜索Inno Setup新闻组很有帮助.

I would like to disable or hide one of the component choices at run-time. I have created a custom wizard page with two radio buttons. If the first radio button is selected, I would like one of the components (CustomInstall) to not appear, or at least be disabled.

Of course, the custom page appears prior to the Components page.

I have tried to do this with a Check: parameter, but it appears that the [Components] section is evaluated at startup, and not when the page is displayed.

So my next thought was to add some code to my CurPageChanged() so that I could remove or disable the item from the CheckListBox (which I think is called ComopnentsList), but I can't find any documentation on TNewCheckListBox.

Does anyone know more about this class? Will what I am thinking work?

解决方案

Here's what I ended up doing:

if CurPageID=wpSelectComponents then
begin
  if ExtraOptionAvailable() then
  begin
    Wizardform.ComponentsList.Checked[6] := true;
    Wizardform.ComponentsList.ItemEnabled[6] := true;
  end else begin
    Wizardform.ComponentsList.Checked[6] := false;
    Wizardform.ComponentsList.ItemEnabled[6] := false;
  end;
end;

Searching the Inno Setup newsgroups at http://www.jrsoftware.org/newsgroups.php was very helpful.

这篇关于Inno Setup:在运行时隐藏/禁用组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 07:20