From 95df32d7f497afd6ef2b5b104b138f0bae7d7de4 Mon Sep 17 00:00:00 2001 From: kichik Date: Sun, 3 Aug 2003 10:51:59 +0000 Subject: [PATCH] Way simpler git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2778 212acab6-be3b-0410-9dea-997c60f758d6 --- Examples/one-section.nsi | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/Examples/one-section.nsi b/Examples/one-section.nsi index 75293265..1078366e 100644 --- a/Examples/one-section.nsi +++ b/Examples/one-section.nsi @@ -1,17 +1,6 @@ # This example demonstrates how to control section selection. # It allows only one of the four optional section to be # selected at any given time. -# -# Please note that the initial value will not be what you expect -# it to be if you are are using InstType because InstType is taken -# into consideration after the .onInit, where the initial state is -# set, executes. -# To use this code with InstType you will either have to specify -# you first InstType to match the initial value you set in .onInit -# (only StrCpy $1 ${sec1} is important in this case because the -# other set the section and that will be done by InstType), or set -# the initial section selection from .onSelChange when it is called -# for the first time. #### Uncomment the next line for an example with subsections too # !define USE_SUBSECTION @@ -30,7 +19,7 @@ Section !Required SectionEnd !ifdef USE_SUBSECTION - SubSection /e "choose one" + SubSection /e "choose one" subsec !endif Section "optional #1" sec1 @@ -58,23 +47,14 @@ Function .onSelChange !ifdef USE_SUBSECTION ; Check if the user have selected all of the sections using the sub-section - Push $2 - StrCpy $2 ${SF_SELECTED} - SectionGetFlags ${sec1} $0 - IntOp $2 $2 & $0 - SectionGetFlags ${sec2} $0 - IntOp $2 $2 & $0 - SectionGetFlags ${sec3} $0 - IntOp $2 $2 & $0 - SectionGetFlags ${sec4} $0 - IntOp $2 $2 & $0 - StrCmp $2 0 skip + SectionGetFlags ${subsec} $0 + IntOp $0 $0 & ${SF_SELECTED} + StrCmp $0 0 skip SectionSetFlags ${sec1} 0 SectionSetFlags ${sec2} 0 SectionSetFlags ${sec3} 0 SectionSetFlags ${sec4} 0 skip: - Pop $2 !endif ; Turn off old selected section