简体   繁体   English

如果没有选定的组件,则禁用组件页面上的“下一步”按钮

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

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 2.46为我的Windows应用程序创建一个安装程序,我有一个包含12个复选框的组件页面,这是我的NSIS代码中的12个部分,现在我想要禁用“下一步”按钮,如果没有检查任何部分用户,我正在使用此代码: NSIS代码

Somehow it doesn't accept R registers above R9... 不知何故,它不接受R9以上的R寄存器...

    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... 如果组件超过10个,请告诉我如何禁用“下一步”按钮...

The basic NSIS registers are $0...$9 and $R0...$R9, so you should use $1 and $2 for the last two sections. 基本的NSIS寄存器是$ 0 ... $ 9和$ R0 ... $ R9,因此最后两节应该使用$ 1和$ 2。 Or you can create more variables if you want; 或者,如果需要,您可以创建更多变量; Var /GLOBAL R10 . Var /GLOBAL R10

If section1 to section12 are numbered without gaps you can use a loop: 如果第1节至第12节的编号没有空格,则可以使用循环:

!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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM