我希望有这样的东西:
o Simulink
o Simulink 3D Animation
o Simulink Control Design
o Stateflow
o Stateflow Coder
例如当" o Simulink 3D动画"如果选中,则应自动检查Simulink并对Stateflow进行相同的操作。
我有以下代码:
Section /o "Simulink"
;SectionIn RO
FileWrite $9 "product=Simulink$\r$\n"
AddSize 0
SectionEnd
Section "Simulink 3D Animation"
SectionIn RO
FileWrite $9 "product=Simulink 3D Animation$\r$\n"
AddSize 0
SectionEnd
Section /o "Simulink Control Design"
;SectionIn RO
FileWrite $9 "product=Simulink Control Design$\r$\n"
AddSize 0
SectionEnd
Section "Stateflow"
SectionIn RO
FileWrite $9 "product=Stateflow$\r$\n"
AddSize 0
SectionEnd
Section "Stateflow Coder"
SectionIn RO
FileWrite $9 "product=Stateflow Coder$\r$\n"
AddSize 0
SectionEnd
如果选中,我有以下功能:
Section /o "Simulink 3D Animation" box_BONUS
;SectionIn RO
FileWrite $9 "product=Simulink 3D Animation$\r$\n"
AddSize 0
SectionEnd
Section /o "Simulink" box_MAIN
;SectionIn RO
FileWrite $9 "product=Simulink$\r$\n"
AddSize 0
SectionEnd
Function .OnSelChange
${If} ${SectionIsSelected} ${box_BONUS}
MessageBox MB_OK "simple message box"
!insertmacro SelectSection ${box_MAIN}
!insertmacro SetSectionFlag ${box_MAIN} ${SF_RO}
${Else}
!insertmacro ClearSectionFlag ${box_MAIN} ${SF_RO}
${EndIf}
FunctionEnd
使用此代码,我没有将工具分组,并且我不想为每个工具提供一个功能:一个用于Simulink,一个用于Stateflow ....我可以创建一个函数为所有工具工作?
答案 0 :(得分:1)
您可以像这样使用SectionGroup:
SectionGroup "Simulink"
Section "Simulink 3D Animation"
# your code
SectionEnd
Section "Simulink Control Design"
# your code
SectionEnd
SectionGroupEnd
我不确切知道您的安装程序应该如何工作。但是,例如,如果任何子部分需要一些必需的文件,您可以在SectionGroup中添加必需的部分。
SectionGroup "Simulink"
Section -"Required Simulink Stuff"
# your code
SectionEnd
# more Sections
SectionGroupEnd
一旦选择了SectionGroup中的任何部分,这将始终运行(注意部分名称前面的破折号!)
如果您正在寻找更高级的设置,为什么不直接从您的某个子部分调用函数?
SectionGroup "Simulink"
Section "Simulink 3D Animation"
Call Requirements_3dAnim
SectionEnd
# more Sections
SectionGroupEnd
Function Requirements_3dAnim
# your code
Functions