Search code examples
inno-setuppascalscript

Inno Setup: Disable specific Types from menu - similar to Components method previously posted


First I: Searched a lot but did not find anything that seemed to cover this, but i might be missing it. (my coding sucks so I don't always know the right thing to search)

Scenario: I like using the drop down list approach of selection more than the radio buttons or check boxes. So I typically add a Type for each component and disable component screen so the user just selects the appropriate option.

However I would like sometimes to check if a condition is met before offering the ability to select or reduce the list altogether.

What I did find: For conditions I found this post Hide/Disable Component at runtime I tried it his way works but I would like to do the same thing but with Types.

Next?: I cannot find if there is something like WizardForm.TypesList.ItemEnabled (I know that is not a real call)

Can this be done without building a fully custom types page? Also can it be a true hide? (disable works for me as well, hide is just cleaner)


Solution

  • To hide a setup type conditionally, use the Check parameter in the Types section.

    [Types]
    Name: "typeA"; Description: "A installation"
    Name: "typeB"; Description: "B installation"
    Name: "typeConditional"; Description: "Some other installation"; Check: CanInstallOther
    
    [Code]
    
    function CanInstallOther: Boolean;
    begin
      Result := ...;
    end;
    

    I do not think you can really disable an item of the drop down list. You can prevent a user from selecting it, but you cannot make it gray or something.