Disable 'next' button on the component pag

2019-05-31 18:55发布

I'm using NSIS 2.46 to create a installer for my windows application, I have a component page with 12 checkboxes, that is 12 sections in my NSIS code, now I want to disable the 'Next' button if none of the sections are checked by the user, I'm using this code: NSIS Code

Somehow it doesn't accept R registers above R9...

    SectionGetFlags ${section11} $R10 
    SectionGetFlags ${section12} $R11

The compiler error I'm getting is Compiler error

Please tell me how to disable the 'Next' button if there are more than 10 components...

1条回答
叛逆
2楼-- · 2019-05-31 19:28

The basic NSIS registers are $0...$9 and $R0...$R9, so you should use $1 and $2 for the last two sections. Or you can create more variables if you want; Var /GLOBAL R10.

If section1 to section12 are numbered without gaps you can use a loop:

!include LogicLib.nsh

Section A S_1
SectionEnd
Section /o B S_2
SectionEnd
Section C S_3
SectionEnd


Function .onSelChange
StrCpy $0 0
StrCpy $1 ${S_1}
${DoWhile} $1 <= ${S_3}
    ${If} ${SectionIsSelected} $1
        StrCpy $0 1
        ${ExitDo}
    ${EndIf}
    IntOp $1 $1 + 1
${Loop}
GetDlgItem $1 $HwndParent 1
EnableWindow $1 $0
FunctionEnd
查看更多
登录 后发表回答