Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup: Hide/Disable Component at runtime

Tags:

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?

like image 553
Marc Bernier Avatar asked Sep 08 '11 20:09

Marc Bernier


1 Answers

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.

like image 71
Marc Bernier Avatar answered Oct 31 '22 19:10

Marc Bernier