문제

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top