Archive: How to enable/disable an optional section with code?


How to enable/disable an optional section with code?
I have an optional section, but I want to enable/disable it based on another choice the user has made (not the normal "select what to install" page).

What variable do I set, or macro do I call, etc?

Here's what I want:


Section "FirstSection"
${If} $MYVAR == 1
; Enable SecondSection
${Else}
; Disable SecondSection
${EndIf}
SectionEnd

Section /o "SecondSection"
; does some stuff
SectionEnd


My google-fu must be weak today because this seems like it would be pretty common but I can't find any hints out there.

You can use SectionSetFlags to enable / disable a section using the ${SF_RO} flag.

BTW, you have to set the flag before the components page is shown, or in the .onSelChange Function


Thanks for the tip! Once I knew what to search for, I found this wiki page:

http://nsis.sourceforge.net/Managing...ons_on_Runtime

Hmm, it isn't showing the URL, but the wiki page is entitled "Managing Sections on Runtime".