每当用户选择“自定义”安装类型时,我想取消选择所有部分。这是我唯一想到或能够找到的东西。但它没有按预期工作。您可以选择“自定义选择”,它确实清除了所有部分选择,但是您无法选择任何部分。
InstType /NOCUSTOM
InstType "Desktop"
InstType "Laptop"
InstType "Custom Selections"
!define Desktop 1
!define Laptop 2
Section "Theme" Theme
SectionIn ${Desktop} ${Laptop}
; ...
SectionEnd
Section "Hibernate" Hibernate
SectionIn ${Desktop}
ExecWait 'powercfg /change /monitor-timeout-ac 15'
ExecWait 'powercfg /change /hibernate-timeout-ac 180'
SectionEnd
; More sections
答案 0 :(得分:0)
自定义类型是特殊的,在没有其他InstType与当前选择匹配时使用。为了得到你想要的东西你必须使用一点点黑客:
Page Components
Page InstFiles
InstType "Desktop"
InstType "Laptop"
!define Desktop 1
!define Laptop 2
Section "Theme" Theme
SectionIn ${Desktop} ${Laptop}
SectionEnd
Section "Hibernate" Hibernate
SectionIn ${Desktop}
SectionEnd
!include WinMessages.nsh
!include LogicLib.nsh
!include Sections.nsh
!macro HACK_GetUpdatedCurInstType ret tmp
FindWindow ${tmp} "#32770" "" $HWNDPARENT
GetDlgItem ${tmp} ${tmp} 0x3F9
SendMessage ${tmp} ${CB_GETCURSEL} 0 0 ${ret}
SendMessage ${tmp} ${CB_GETITEMDATA} ${ret} 0 ${ret}
!macroend
Function .onSelChange
!insertmacro HACK_GetUpdatedCurInstType $1 $0
Var /GLOBAL prevSelInstType
${If} $1 = ${NSIS_MAX_INST_TYPES} ; Custom
${AndIf} $1 <> $prevSelInstType
!insertmacro UnselectSection ${Theme}
!insertmacro UnselectSection ${Hibernate}
${EndIf}
StrCpy $prevSelInstType $1
FunctionEnd