Old 25th September 2009, 19:17   #1
jeffadams78
Junior Member
 
Join Date: Aug 2007
Posts: 15
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:

code:

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.
jeffadams78 is offline   Reply With Quote
Old 25th September 2009, 20:31   #2
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
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
jpderuiter is offline   Reply With Quote
Old 28th September 2009, 16:08   #3
jeffadams78
Junior Member
 
Join Date: Aug 2007
Posts: 15
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".
jeffadams78 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump