Wonky Roger
Wonky Roger

Reputation: 257

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?

Upvotes: 0

Views: 1678

Answers (1)

Anders
Anders

Reputation: 101636

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

Upvotes: 2

Related Questions