![](/img/trans.png)
[英]using nsis installer, adding custom radiobuttons, calling sections according to radiobutton chosen
[英]hide section in nsis installer conditionally on choice of radiobuttons
如何在 MUI NSIS 安裝程序組件頁面對話框中選中或取消選中 RadioButtons 時有條件地隱藏部分。
我添加了 2 個 RadioButtons、DEMO 和 BACKUP。
當用戶選擇 DEMO RadioButton 時,顯示的部分將是“安裝數據或不”,用戶可以選中或取消選中,“備份數據或不”部分將被隱藏。
當用戶選擇 BACKUP RadioButton 時,顯示的部分將是“BACKUP DATA OR NOT”,用戶可以選中或取消選中,&“INSTALL DATA OR NOT”部分將被隱藏。
如果我使用 - 符號,則“是否安裝數據”部分對於 BOTH RADIOBUTTON CHOICES,即 DEMO 和 UPDATE 也是隱藏的,請幫助。
此外,還有 SelectSection 或 UnSelectSection 的功能,但它們不會隱藏 Section,這正是我想要的,即 Section 應該被隱藏和取消選中。
隱藏部分沒有名稱,因此您需要為其命名以使其再次可見:
!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 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.