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

时间:2016-04-12 20:06:16

标签: nsis

在我的安装程序中,我有2个选项显示为单选按钮。更新并安装。我希望默认选择更新选项。我应该对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

1 个答案:

答案 0 :(得分:0)

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

!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
相关问题