当没有选定的组件时,在组件页面上禁用“下一步"按钮 [英] Disable 'next' button on the component page when there are no selected components

查看:261
本文介绍了当没有选定的组件时,在组件页面上禁用“下一步"按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用NSIS 2.46为Windows应用程序创建安装程序,我有一个带有12个复选框的组件页面,即我的NSIS代码中的12个部分,现在我想禁用下一步"按钮(如果没有)部分由用户检查,我正在使用此代码:

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:

以某种方式它不接受R9以上的R寄存器...

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

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

我遇到的编译器错误是

The compiler error I'm getting is

如果组件超过10个,请告诉我如何禁用下一步"按钮.

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

推荐答案

NSIS的基本寄存器是$ 0 ... $ 9和$ R0 ... $ R9,因此在后两节中应分别使用$ 1和$ 2.或者,您可以根据需要创建更多变量; Var /GLOBAL R10.

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.

如果第1节至第12节的编号没有空格,则可以使用循环:

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

这篇关于当没有选定的组件时,在组件页面上禁用“下一步"按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆