Disable 'next' button on the component page when there are no selected components

别等时光非礼了梦想. 提交于 2019-12-23 02:31:41

问题


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:

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

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

The compiler error I'm getting is

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


回答1:


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


来源:https://stackoverflow.com/questions/8410859/disable-next-button-on-the-component-page-when-there-are-no-selected-component

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!