Selection 当出现“时,取消选择所有部分”;海关;选择了一种新的类型

Selection 当出现“时,取消选择所有部分”;海关;选择了一种新的类型,selection,nsis,Selection,Nsis,每当用户选择“自定义”安装类型时,我想取消选择所有部分。这是我唯一想到或能够找到的东西。但它并没有像预期的那样起作用。您可以选择“自定义选择”,它确实会清除所有的节选择,但是您不能选择任何节 InstType /NOCUSTOM InstType "Desktop" InstType "Laptop" InstType "Custom Selections" !define Desktop 1 !define Laptop 2 Section "Theme" Theme Sectio

每当用户选择“自定义”安装类型时,我想取消选择所有部分。这是我唯一想到或能够找到的东西。但它并没有像预期的那样起作用。您可以选择“自定义选择”,它确实会清除所有的节选择,但是您不能选择任何节

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

自定义类型是特殊类型,在没有其他类型与当前选择匹配时使用。要想得到你想要的,你必须使用一些小技巧:

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
页面组件
页面文件
输入“桌面”
InstType“笔记本电脑”
!定义桌面1
!定义笔记本电脑2
“主题”部分主题
${Desktop}${Laptop}中的部分
分段结束
“休眠”部分休眠
${Desktop}中的节
分段结束
!包括WinMessages.nsh
!包括LogicLib.nsh
!包括第3.nsh节
!宏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}
!宏端
函数onSelChange
!insertmacro HACK_GetUpdatedCurInstType$1$0
变量/全局prevSelInstType
${If}$1=${NSIS_MAX_INST_TYPES};习俗
${AndIf}$1$prevSelInstType
!insertmacro取消选择节${Theme}
!insertmacro取消选择节${Hibernate}
${EndIf}
StrCpy$preverselinstType$1
功能端

这个问题基本上是重复的