NSIS单选按钮,不是在单击以调用函数时,而是在单击"next"之后



我在这里和nsis都是新手。我有一个带有一些自定义页面和单选按钮的nsi脚本。

我的问题是,当我选择一个单选按钮时,函数会立即被调用。点击"下一步"后我想要它。我知道这是因为NSD_OnClick,但它是一种替代方案吗?

这里有一些代码:

Function plugins
     nsDialogs::Create 1018
     Pop $Dialog
     ${NSD_CreateLabel} 0 0 100% 16u "Install Plugins?:"
     ${NSD_CreateRadioButton} 20 40 100% 12u "Yes"
         Pop $hwnd
         ${NSD_AddStyle} $hwnd ${WS_GROUP}
         ${NSD_OnClick} $hwnd Yes
     ${NSD_CreateRadioButton} 20 60 100% 12u "No"
         Pop $hwnd
         ${NSD_OnClick} $hwnd No
     nsDialogs::Show
FunctionEnd
Function Yes
     ;Install Plugins...
FunctionEnd

您可以在Yes回调中保留单选按钮的状态,稍后在plugins自定义页面的离开回调中根据状态选择是否安装。

大致:

Var isSelected
Function Yes
    StrCpy $isSelected 1
FunctionEnd
Function No
    StrCpy $isSelected 0
FunctionEnd
Function PlunginsLeavePage #<--you need to declare that in the "Page Custom"
    ${if} $isSelected = 1
        ;Install Plugins (this was formerly in the Yes function)
    ${endIf}
FunctionEnd

最新更新