Nsis 如何仅在某个InstType中禁用某个节,而在其他情况下强制启用它(即使在“自定义”InstType中)?
我有一个Nsis 如何仅在某个InstType中禁用某个节,而在其他情况下强制启用它(即使在“自定义”InstType中)?,nsis,Nsis,我有一个部分,它被设置为RO,出现在所有InstType中,除了一个特殊部分 当用户首先选择特殊的InstType,然后选择“Custom”作为InstType时,该部分被取消选中,并且不能在“Custom”InstType中再次检查 因此,除了用户选择“Custom”InstType时,部分应始终再次检查外,一切正常 只有在特殊的InstType用例中才应取消选中它 我如何才能做到这一点?您可以强制执行您想要的任何逻辑。onSelChange: !include WinMessages.nsh
部分
,它被设置为RO
,出现在所有InstType
中,除了一个特殊部分
当用户首先选择特殊的InstType
,然后选择“Custom”作为InstType
时,该部分被取消选中,并且不能在“Custom”InstType
中再次检查
因此,除了用户选择“Custom”InstType
时,部分应始终再次检查外,一切正常
只有在特殊的InstType
用例中才应取消选中它
我如何才能做到这一点?您可以强制执行您想要的任何逻辑。onSelChange:
!include WinMessages.nsh
!include LogicLib.nsh
!include Sections.nsh
Page Components
Page InstFiles
InstType "Normal1"
!define CIT_Special 1
InstType "Special"
InstType "Normal2"
Section Foo
SectionIn 1 2 3
SectionEnd
Section Bar SEC_Special
SectionIn 1 3
SectionIn RO
SectionEnd
Section Baz
SectionIn 1 2 ;3 << Not the same as Foo just to have some sort of difference
SectionEnd
Function .onSelChange
;Normally you would call GetCurInstType here, but it seems we need a little hack to detect the custom section
FindWindow $1 "#32770" "" $HWNDPARENT
GetDlgItem $1 $1 0x3F9
SendMessage $1 ${CB_GETCURSEL} 0 0 $2
SendMessage $1 ${CB_GETITEMDATA} $2 0 $2
${If} $2 = ${CIT_Special}
!insertmacro UnselectSection ${SEC_Special}
${Else}
!insertmacro SelectSection ${SEC_Special}
${EndIf}
FunctionEnd
!包括WinMessages.nsh
!包括LogicLib.nsh
!包括第3.nsh节
页面组件
页面文件
InstType“Normal1”
!定义CIT_特殊1
InstType“特殊”
InstType“Normal2”
福科
第1、2、3节
分段结束
型材专用
第13节
反渗透
分段结束
第Baz节
第12节;3证明GetCurInstType行为是设计的,它返回的当前insttype不一定与组合框选择相同。