NSIS脚本中的默认单选按钮选择



在我的安装程序中,我有两个选项显示为单选按钮。更新并安装。默认情况下,"我想要更新"选项处于选中状态。我应该将哪个选项与NSD_CreateRadioButton一起使用,以便在默认情况下选择更新?现在,在我的情况下,没有选择任何选项。

${NSD_CreateRadioButton} 30% 50% 100% 20 "Install"
pop $1
${IfThen} $InstallType == INSTALL ${|} ${NSD_Check} $1 ${|}
${NSD_CreateRadioButton} 30% 60% 100% 20 "Update"
pop $2

你走在了正确的轨道上,你只需要模拟点击你想成为默认值的单选按钮:

!include nsDialogs.nsh
Page Custom MyPageCreate
Page InstFiles
Function MyPageCreate
nsDialogs::Create 1018
Pop $0
${NSD_CreateRadioButton} 30% 50% 100% 20 "Install"
pop $1
${NSD_CreateRadioButton} 30% 60% 100% 20 "Update"
pop $2
${If} $InstallType == INSTALL
    ${NSD_Check} $1 ; Select Install radio
${Else}
    ${NSD_Check} $2 ; Select Update radio
${EndIf}
nsDialogs::Show
FunctionEnd

一个模拟点击您想要成为默认的单选按钮的其他解决方案

SendMessage $1 ${BM_CLICK} "" ""

最新更新