简体   繁体   中英

MUI pages order in NSIS

How to change order of pages depending on some clauses? For example, there are 2 radiobuttons on custom page - 'repair programm' and 'uninstall programm'. When I select 'repair programm' next should show 5 pages and when I select another radiobutton should be 2 pages. And is it possible use in uninstaller install pages and vice versa?

MUI_UNPAGE_CONFIRM does not really make sense in a installer, other than that you can use all page types in both the installer and uninstaller.

To skip a page you must call Abort in the pre callback function for that page. You can also jump directly to a specific page .

!include MUI2.nsh
!include LogicLib.nsh

Var pagemode
Function selectpagemode
MessageBox MB_YESNO "Mode A?" IDNO nope
    StrCpy $pagemode "A"
    Return
    nope:
    StrCpy $pagemode "B"
FunctionEnd

Function onlymodeA
${IfThen} $pagemode != "A" ${|} Abort ${|}
FunctionEnd
Function onlymodeB
${IfThen} $pagemode == "A" ${|} Abort ${|}
FunctionEnd

!define MUI_PAGE_CUSTOMFUNCTION_LEAVE selectpagemode
!insertmacro MUI_PAGE_WELCOME 

;Mode A
!define MUI_PAGE_CUSTOMFUNCTION_PRE onlymodeA
!insertmacro MUI_PAGE_LICENSE "${__FILE__}"
!define MUI_PAGE_CUSTOMFUNCTION_PRE onlymodeA
!insertmacro MUI_PAGE_COMPONENTS

;Mode B
!define MUI_PAGE_CUSTOMFUNCTION_PRE onlymodeB
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_PAGE_CUSTOMFUNCTION_PRE onlymodeB
!insertmacro MUI_PAGE_LICENSE "${__FILE__}"

!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM