From d9fe9f12823bd0e1dd856f536535d10f11f21e72 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 9 Aug 2002 13:00:17 +0000 Subject: [PATCH] Now works when you select a selected section git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@672 212acab6-be3b-0410-9dea-997c60f758d6 --- Examples/one-section.nsi | 56 +++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/Examples/one-section.nsi b/Examples/one-section.nsi index ab3a753b..8cfb0c34 100644 --- a/Examples/one-section.nsi +++ b/Examples/one-section.nsi @@ -1,7 +1,7 @@ Name example OutFile setup.exe -ComponentText "please choose just one but the the default" +ComponentText "please choose just one but the default" Section !Required SectionIn RO @@ -19,12 +19,15 @@ SectionEnd Section "optional #4" sec4 SectionEnd +!define SECTION_ON 0x80000000 !define SECTION_OFF 0x7FFFFFFF Function .onInit + Push $0 + StrCpy $1 ${sec1} ; Gotta remember which section we are at now... SectionGetFlags ${sec1} $0 - IntOp $0 $0 | 0x80000000 + IntOp $0 $0 | ${SECTION_ON} SectionSetFlags ${sec1} $0 SectionGetFlags ${sec2} $0 @@ -38,42 +41,43 @@ Function .onInit SectionGetFlags ${sec4} $0 IntOp $0 $0 & ${SECTION_OFF} SectionSetFlags ${sec4} $0 + + Pop $0 FunctionEnd Function .onSelChange + Push $0 + ; Turn off old selected section - StrCmp $1 ${sec1} 0 +4 - SectionGetFlags ${sec1} $0 - IntOp $0 $0 & ${SECTION_OFF} - SectionSetFlags ${sec1} $0 - StrCmp $1 ${sec2} 0 +4 - SectionGetFlags ${sec2} $0 - IntOp $0 $0 & ${SECTION_OFF} - SectionSetFlags ${sec2} $0 - StrCmp $1 ${sec3} 0 +4 - SectionGetFlags ${sec3} $0 - IntOp $0 $0 & ${SECTION_OFF} - SectionSetFlags ${sec3} $0 - StrCmp $1 ${sec4} 0 +4 - SectionGetFlags ${sec4} $0 - IntOp $0 $0 & ${SECTION_OFF} - SectionSetFlags ${sec4} $0 + SectionGetFlags $1 $0 + IntOp $0 $0 & ${SECTION_OFF} + SectionSetFlags $1 $0 ; Now remember the current selection + Push $2 + StrCpy $2 $1 + SectionGetFlags ${sec1} $0 - IntOp $0 $0 & 0x80000000 - IntCmp $0 0x80000000 0 +2 +2 + IntOp $0 $0 & ${SECTION_ON} + IntCmp $0 ${SECTION_ON} 0 +2 +2 StrCpy $1 ${sec1} SectionGetFlags ${sec2} $0 - IntOp $0 $0 & 0x80000000 - IntCmp $0 0x80000000 0 +2 +2 + IntOp $0 $0 & ${SECTION_ON} + IntCmp $0 ${SECTION_ON} 0 +2 +2 StrCpy $1 ${sec2} SectionGetFlags ${sec3} $0 - IntOp $0 $0 & 0x80000000 - IntCmp $0 0x80000000 0 +2 +2 + IntOp $0 $0 & ${SECTION_ON} + IntCmp $0 ${SECTION_ON} 0 +2 +2 StrCpy $1 ${sec3} SectionGetFlags ${sec4} $0 - IntOp $0 $0 & 0x80000000 - IntCmp $0 0x80000000 0 +2 +2 + IntOp $0 $0 & ${SECTION_ON} + IntCmp $0 ${SECTION_ON} 0 +2 +2 StrCpy $1 ${sec4} + + StrCmp $2 $1 0 +2 ; selection hasn't changed + SectionGetFlags $1 $0 + IntOp $0 $0 | ${SECTION_ON} + SectionSetFlags $1 $0 + Pop $2 + Pop $0 FunctionEnd \ No newline at end of file