Archive: Custom Page HIDE / SHOW


Custom Page HIDE / SHOW
Hi,

I have 2 custom pages and both pages are functionable.
But now my problem:
At the MUI_PAGE_COMPONENTS I have 3 checkboxes (3 Sections in the script). If the first checkbox is selected, both custom pages should be available. If the second checkbox is selected, only the second custom page should be available and if the third checkbox is selected none of the both custom pages should be available.

The order of my pages is MUI_PAGE_COMPONENTS; MUI_PAGE_DIRECTORY; MUI_PAGE_INSTFILES; custompage1; custompage2; MUI_PAGE_FINISH.
The custom pages are after the MUI_PAGE_INSTFILES, because they will replace special files. In other way the original files will be restored at the MUI_PAGE_INSTFILES.

How can i do this, what i described above???
I need quickly a reply, 'cause it's really important for me and it should be described in an easy way.

Thanks a lot.


either use SectionGetFlags, set variables or use LogicLib (recommended) in the sections to check whether the section was selected or not

then based on which option was selected, call Abort in the Custom page's create function to skip that page.


!addplugindir "."
!addincludedir "."

!include "nsDialogs.nsh"
!include "winmessages.nsh"
!include "logiclib.nsh"
!include "sections.nsh"

!include "MUI2.nsh"

OutFile "test.exe"

var dialog
var hwnd
var null

Page Components
Page Custom CustomPageA
Page Custom CustomPageB
Page Custom CustomPageC

Section "A and B" AandB
SectionEnd

Section "B only" Bonly
SectionEnd

Section "Neither" neither
SectionEnd

Function CustomPageA
${If} ${SectionIsSelected} ${Bonly}
${OrIf} ${SectionIsSelected} ${neither}
Abort
${EndIf}

nsDialogs::Create 1018
Pop $dialog

${NSD_CreateLabel} 0 0 100% 8% "Page A"
Pop $0

nsDialogs::Show
FunctionEnd

Function CustomPageB
${If} ${SectionIsSelected} ${neither}
Abort
${EndIf}
nsDialogs::Create 1018
Pop $dialog

${NSD_CreateLabel} 0 0 100% 8% "Page B"
Pop $0

nsDialogs::Show
FunctionEnd
Function CustomPageC
nsDialogs::Create 1018
Pop $dialog

${NSD_CreateLabel} 0 0 100% 8% "Page C"
Pop $0

nsDialogs::Show
FunctionEnd

!insertmacro MUI_LANGUAGE "English"


Sounds like you'll want to look into the Radiobuttons page on the NSIS wiki to make your Components page's section selections behave like radiobuttons (only 1 selection possible) as well. Although if you go down that road - perhaps you should skip the Components page and create a new Custom page with proper radiobuttons instead.

Thanks for your help, the way you write it i use it and all were ok.