简体   繁体   English

在 nsis 中使用单选按钮后跟自定义按钮

[英]using radio button followed by custom button in nsis

i have created an installer using NSIS.我已经使用 NSIS 创建了一个安装程序。 In that i have included 2 radio buttons.其中我包括了 2 个单选按钮。 whenever user selects any of the radio buttons it immediately starts execution, but i want after selecting a radio button execution should start only after user presses a custom button say Next.每当用户选择任何单选按钮时,它都会立即开始执行,但我希望在选择单选按钮后执行应该仅在用户按下自定义按钮说下一步后开始。

So how to add button(say Next) in my script and how can i connect my radio button selection with it?那么如何在我的脚本中添加按钮(比如下一步)以及如何将我的单选按钮选择与它连接起来?

the partial code snippet is as follows:部分代码片段如下:

Function mode_selection

    nsDialogs::Create 1018
    Pop $dialog
    ${NSD_CreateLabel} 0 10 75% 20u "Choose your preference....."
    Pop $0 

    ${NSD_CreateRadioButton}  20 60 100% 25u "Execution Mode"
    Pop $hwnd
    ${NSD_AddStyle} $hwnd ${WS_GROUP}
    ${NSD_OnClick} $hwnd exec_mode

    ${NSD_CreateRadioButton} 20 90 100% 25u "Debug Mode "
    Pop $hwnd
    ${NSD_OnClick} $hwnd debug_mode


nsDialogs::Show

FunctionEnd

Function exec_mode

    ;some code

FunctionEnd
Function debug_mode

     ;some code

FunctionEnd
!include nsDialogs.nsh
!include LogicLib.nsh
Page custom mode_selection

var hwndExecModeRadio

Function mode_selection
nsDialogs::Create 1018 
Pop $0
${NSD_CreateLabel} 0 10 75% 20u "Choose your preference....."
Pop $0 

${NSD_CreateRadioButton} 20 60 80% 25u "Execution Mode"
Pop $hwndExecModeRadio
${NSD_AddStyle} $hwndExecModeRadio ${WS_GROUP}

${NSD_CreateRadioButton} 20 90 80% 25u "Debug Mode "
Pop $0

${NSD_CreateButton} 20 150 -40 14u "Do it"
Pop $0
${NSD_OnClick} $0 perform_mode

nsDialogs::Show
FunctionEnd

Function perform_mode
    ${NSD_GetState} $hwndExecModeRadio $0
    ${If} $0 = ${BST_CHECKED}
        Call exec_mode
    ${Else}
        Call debug_mode
    ${EndIF}
FunctionEnd

Function exec_mode
    MessageBox mb_ok "exec_mode"
FunctionEnd 

Function debug_mode
    MessageBox mb_ok "debug_mode"
FunctionEnd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM