【问题标题】:NSIS: Componesnts page on component checked eventNSIS:组件检查事件上的组件页面
【发布时间】:2017-08-16 04:00:52
【问题描述】:

我使用 NSIS 来安装我的项目。当我选择要在组件页面上安装的某些部分时,我需要显示带有警告文本的 MessageBox。有什么方法可以跟踪复选框的点击,可能是事件还是什么?

【问题讨论】:

标签: installation nsis


【解决方案1】:

使用.onSelChange callback

在 NSIS 3 中,更改的部分 id 存储在 $0 中:

Page Components
Page InstFiles

Section /o "Foo" SID_FOO
SectionEnd

Section "Bar"
SectionEnd

!include LogicLib.nsh

Function .onSelChange
${If} ${SectionIsSelected} ${SID_FOO}
${AndIf} $0 = ${SID_FOO}
    MessageBox MB_ICONEXCLAMATION "Warning, section Foo selected!"
${EndIf}
FunctionEnd

您必须自己在 NSIS 2 中跟踪状态:

Page Components
Page InstFiles

Section /o "Foo" SID_FOO
SectionEnd

Section "Bar"
SectionEnd

!include LogicLib.nsh

Var hasWarned

Function .onSelChange
${If} ${SectionIsSelected} ${SID_FOO}
${AndIf} $hasWarned = 0
    StrCpy $hasWarned 1
    MessageBox MB_ICONEXCLAMATION "Warning, section Foo selected!"
${EndIf}
/* Uncomment this to display the warning every time it is selected
${IfNot} ${SectionIsSelected} ${SID_FOO}
    StrCpy $hasWarned 0
${EndIf}
*/
FunctionEnd

【讨论】:

    猜你喜欢
    • 2011-05-04
    • 2012-09-15
    • 2013-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多