enter image description here

我希望,如果没有选择一个放射线,那么,当按下下一个按钮时,它应该发出警报,请至少选择一项,并且不应转到下一个对话框。

另外,我希望如果用户选择选项:更新现有软件,则仅复制某些文件,如果选择了其他radiobutton,则将所有文件复制,

是否必须使用部分或必须使用功能?我可以调用一个部分,例如选择RadioButton 1,然后称为createAllfiles e节

根据我的说法,我认为我希望代码如何保存这两个放射线量的ID并相应地使用它们,以调用不同的部分或功能。代码是什么?请帮忙?

另外,按下此页面下一个页面之后,下一个对话框将如下图所示:我想显示标签,是否完成或更新正在运行,为此,我将使用Resource Hacker添加标签,但是如何显示该标签并根据RadioButton的用户选择隐藏enter image description here

有帮助吗?

解决方案

您可以选择/取消选择部分,也可以将逻辑放入单个部分中,此示例确实可以:

!include nsDialogs.nsh
!include Sections.nsh

var InstallType

Section 
#Install common files...
${If} $InstallType == DEMO
    #Do demo specific stuff
${Else}
    #Do update specific stuff
${EndIf}
SectionEnd

Section "" SEC_DEMO
#Install demo..
SectionEnd

Section "" SEC_UPDATE
#Do update..
SectionEnd

Page custom InstTypePageCreate InstTypePageLeave

Function InstTypePageCreate
nsDialogs::Create 1018
pop $0
${NSD_CreateRadioButton} 0 50u 100% 10u "Demo"
pop $1
${IfThen} $InstallType == DEMO ${|} ${NSD_Check} $1 ${|}
${NSD_CreateRadioButton} 0 70u 100% 10u "Update"
pop $2
${IfThen} $InstallType == UPDATE ${|} ${NSD_Check} $2 ${|}
nsDialogs::Show
FunctionEnd

Function InstTypePageLeave
${NSD_GetState} $1 $0
${If} $0 = ${BST_CHECKED}
    StrCpy $InstallType DEMO
    !insertmacro UnselectSection ${SEC_UPDATE}
    !insertmacro SelectSection ${SEC_DEMO}
${Else}
    ${NSD_GetState} $2 $0
    ${If} $0 = ${BST_CHECKED}
        StrCpy $InstallType UPDATE
        !insertmacro UnselectSection ${SEC_DEMO}
        !insertmacro SelectSection ${SEC_UPDATE}
    ${Else}
        MessageBox MB_ICONSTOP "You must select something!"
        Abort
    ${EndIf}
${EndIf}
FunctionEnd

要在下一页上设置文本,只需使用 ${NSD_SetText} $hwndYourLabel "Text" 以及在一个IF测试$ installType的if块中的showwindow(此代码需要在该页面的show函数回调(mui_page_customfunction_show)中

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top