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

标签 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

最佳答案

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

!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

关于nsis - NSIS 脚本中的默认单选按钮选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36583058/

相关文章:

windows - 使用管理权限在 NSIS 中执行 Execwait

postgresql - 如何使用带有所有参数的 NSIS 安装 postgres?

http - 是否可以在 NSIS 中使用 http get 和 http post?

nsis - 如何让 NSIS 从临时目录安装和执行文件?

cmake - 如何使用 CPACK_PACKAGE_INSTALL_REGISTRY_KEY 添加注册表项?

powershell - 在 Windows10 上使用 NSIS 启用应用侧载

delphi - NSIS 插件 "nsScreenshot"在 Windows NT 6.x 中无法工作

registry - NSIS 安装程序不写入注册表项

dynamic - NSIS-如何动态显示特定的自定义页面?

installation - NSIS 与 Windows 游戏资源管理器的集成