我有下两节课
Section /o "Communications Toolbox"
;SectionIn RO
FileWrite $9 "product=Communications Toolbox$\r$\n"
AddSize 0
SectionEnd
Section /o "Control System Toolbox"
;SectionIn RO
FileWrite $9 "product=Control System Toolbox$\r$\n"
AddSize 0
SectionEnd在安装过程中,当用户选中第二个“控制系统工具箱”,自动选中第一个“通信工具箱”时,我想要被检查,并在此时显示一条消息“安装控制系统工具箱你还需要安装”通信工具箱“。我怎么能做到这一点?
我试图在“控制系统工具箱”中放置一个文本框:
Section /o "Control System Toolbox"
MessageBox MB_OK "Do you want to stay in the license page?" IDOK
Abort
FileWrite $9 "product=Control System Toolbox$\r$\n"
AddSize 0
SectionEnd我不明白为什么在我按下按钮后,没交上一页?
发布于 2015-08-19 12:00:31
处理此问题的方法有两种:
A)在组件页面上强制执行需求:
Page Components
Page InstFiles
Section /o "Main Component" SID_MAIN
DetailPrint "Installing Main Component..."
SectionEnd
Section /o "Bonus feature" SID_BONUS
DetailPrint "Installing bonus Component..."
SectionEnd
!include Sections.nsh
!include LogicLib.nsh
Function .OnSelChange
${If} ${SectionIsSelected} ${SID_BONUS}
!insertmacro SelectSection ${SID_MAIN} ; The main component is required when installing the bonus component
!insertmacro SetSectionFlag ${SID_MAIN} ${SF_RO}
${Else}
!insertmacro ClearSectionFlag ${SID_MAIN} ${SF_RO}
${EndIf}
FunctionEnd您还可以在其他问题中使用像I suggested这样的节组。
B)在安装阶段使用MessageBox (在InstFiles页面上执行部分代码),并在需要时强制安装组件:
Page Components
Page InstFiles
Section "" ; Hidden section
Call EnsureRequiredSections ; We have to call a function because SID_MAIN has not been defined yet
SectionEnd
Section "Main Component" SID_MAIN
DetailPrint "Installing Main Component..."
SectionEnd
Section /o "Bonus feature" SID_BONUS
DetailPrint "Installing bonus Component..."
SectionEnd
!include Sections.nsh
!include LogicLib.nsh
Function EnsureRequiredSections
${If} ${SectionIsSelected} ${SID_BONUS}
${AndIfNot} ${SectionIsSelected} ${SID_MAIN}
MessageBox MB_YESNO|MB_ICONQUESTION "Main Component is required when installing the Bonus feature, do you want to install both?" IDNO no
!insertmacro SelectSection ${SID_MAIN}
Goto done
no:
!insertmacro UnSelectSection ${SID_BONUS}
done:
${EndIf}
FunctionEndhttps://stackoverflow.com/questions/32091795
复制相似问题