NSIS:组件检查事件上的组件页面
NSIS: Componesnts page on component checked event
我使用 NSIS 安装我的项目。当我选择要在组件页面上安装的部分时,我需要显示带有警告文本的 MessageBox。有什么方法可以跟踪复选框上的点击,可能是事件还是什么?
在 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} [=10=] = ${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
我使用 NSIS 安装我的项目。当我选择要在组件页面上安装的部分时,我需要显示带有警告文本的 MessageBox。有什么方法可以跟踪复选框上的点击,可能是事件还是什么?
在 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} [=10=] = ${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