开发者

hide section in nsis installer conditionally on choice of radiobuttons

How can a section be hidden conditionally on check or uncheck of RadioButtons in MUI NSIS installer Components Page dialog.

I have added 2 RadioButtons, DEMO & BACKUP.

When user chooses, DEMO RadioButton , then Section displayed will be "INSTALL DATA OR NOT", it can be checked or unchecked by the user, & "BACKUP DATA OR NOT" section would be hidden.开发者_如何学运维

When user chooses, BACKUP RadioButton , then Section displayed will be "BACKUP DATA OR NOT", it can be checked or unchecked by the user, & "INSTALL DATA OR NOT" section would be hidden.

IF I USE THE - SIGN, then the section "INSTALL DATA OR NOT" is hidden for BOTH RADIOBUTTON CHOICES, i.e. for DEMO also & for UPDATE also, please help.

Also , there are features of SelectSection or UnSelectSection, but they do not hide the Section, which is what I want, that the Section should be hidden and unchecked.


A hidden section has no name so you need to give it a name for it to become visible again:

!include Logiclib.nsh
!include Sections.nsh

page Components InitComponentsPage

!define INSTALLSECTIONNAME "Install"
section "" SEC_INSTALL
sectionend

!define BACKUPSECTIONNAME "Backup"
section "" SEC_BACKUP
sectionend

Function InitComponentsPage
${If} $InstallType == BACKUP
    SectionSetText ${SEC_BACKUP} "${BACKUPSECTIONNAME}"
    !insertmacro UnSelectSection ${SEC_INSTALL}
    SectionSetText ${SEC_INSTALL} ""
${Else}
    SectionSetText ${SEC_INSTALL} "${INSTALLSECTIONNAME}"
    !insertmacro UnSelectSection ${SEC_BACKUP}
    SectionSetText ${SEC_BACKUP} ""
${EndIf}
Functionend
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜