Old 22nd September 2017, 14:20   #1
ascTim
Junior Member
 
Join Date: May 2015
Posts: 32
Section still installs after deselection

Hi, I need some help... again. Sorry, but I can't find my mistake.

I created a custom page with 5 sections that are autochecked when starting the installer.
For some reason, it will always execute all 5 sections even when they are unchecked.

Any idea why that happens?

PHP Code:
Var Chk_Box1
Var Chk_Box2
Var Chk_Box3
Var Chk_Box4
Var Chk_Box5

Page custom MyPage1 MyPage1Leave

Function MyPage1
nsDialogs
::Create 1018
!insertmacro MUI_HEADER_TEXT "Components" "Komponenteninstallation"
Pop $0
${NSD_CreateLabel0 0 10015u "Select components:"
${NSD_CreateLabel0 150 10015u "Custom Text"
Pop $0
${NSD_CreateCheckbox30 25 350 10u "Section1"
Pop $Chk_Box1
${NSD_CreateCheckbox30 50 350 10u "Section2"
Pop $Chk_Box2
${NSD_CreateCheckbox30 75 350 10u "Section3"
Pop $Chk_Box3
${NSD_CreateCheckbox30 100 350 10u "Section4"
Pop $Chk_Box4
${NSD_CreateCheckbox30 125 350 10u "Section5"
Pop $Chk_Box5

;Auto check checkboxes
${NSD_Check$Chk_Box1
${NSD_Check$Chk_Box2
${NSD_Check$Chk_Box3
${NSD_Check$Chk_Box4
${NSD_Check$Chk_Box5
nsDialogs
::Show
FunctionEnd

Function MyPage1Leave
${NSD_GetState$Chk_Box1 $0
${If} $<> 0
    
!insertmacro SelectSection ${SID_1}
${Else}
    !
insertmacro UnselectSection ${SID_1}
${EndIf}

${
NSD_GetState$Chk_Box2 $0
${If} $<> 0
    
!insertmacro SelectSection ${SID_2}
${Else}
    !
insertmacro UnselectSection ${SID_2}
${EndIf}

${
NSD_GetState$Chk_Box3 $0
${If} $<> 0
    
!insertmacro SelectSection ${SID_3}
${Else}
    !
insertmacro UnselectSection ${SID_3}
${EndIf}

${
NSD_GetState$Chk_Box4 $0
${If} $<> 0
    
!insertmacro SelectSection ${SID_4}
${Else}
    !
insertmacro UnselectSection ${SID_4}
${EndIf}

${
NSD_GetState$Chk_Box5 $0
${If} $<> 0
    
!insertmacro SelectSection ${SID_5}
${Else}
    !
insertmacro UnselectSection ${SID_5}
${EndIf}
FunctionEnd


Section Sec1 SID_1
;Some Install stuff
SectionEnd

Section Sec2 SID_2
;Some Install stuff
SectionEnd

Section Sec3 SID_3
;Some Install stuff
sECTIONeND

Section Sec4 SID_4
;Some Install stuff
SectionEnd

Section Sec5 SID_5
;Some Install stuff
SectionEnd 
I'm also recieving some warnings. Maybe they help you (more than they help me at least):

PHP Code:
warning: !warningMUI_LANGUAGE should be inserted after the MUI_[UN]PAGE_macros (macro:MUI_LANGUAGE:8)
warningunknown variable/constant "{SID_1}" detectedignoring (macro:SelectSection:4)
warningunknown variable/constant "{SID_1}" detectedignoring (macro:UnselectSection:4)
warningunknown variable/constant "{SID_2}" detectedignoring (macro:SelectSection:4)
warningunknown variable/constant "{SID_2}" detectedignoring (macro:UnselectSection:4)
warningunknown variable/constant "{SID_3}" detectedignoring (macro:SelectSection:4)
warningunknown variable/constant "{SID_3}" detectedignoring (macro:UnselectSection:4)
warningunknown variable/constant "{SID_4}" detectedignoring (macro:SelectSection:4)
warningunknown variable/constant "{SID_4}" detectedignoring (macro:UnselectSection:4)
warningunknown variable/constant "{SID_5}" detectedignoring (macro:SelectSection:4)
warningunknown variable/constant "{SID_5}" detectedignoring (macro:UnselectSection:4
ascTim is offline   Reply With Quote
Old 23rd September 2017, 14:26   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,610
The first warning should be obvious.

The SID_ warnings means the section id has not been defined yet and you need to move the sections above the functions in your script.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 26th September 2017, 10:25   #3
ascTim
Junior Member
 
Join Date: May 2015
Posts: 32
That was it, thanks!
ascTim 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