Archive: Add "Advanced Configurations" option to Components Page


Add "Advanced Configurations" option to Components Page
I'd like to add an optional "Advanced Configuration" page(s) to my installer. If anyone's familiar with the SQL Express Installation you may remember that theres a "hide advanced configuration options" checkbox on the bottom left corner of the Registration Page.

Using MUI + InstallOptions Ive managed to the create the page I need, but I'm not sure how to make this page only appear when the user has selected the option.

I supposed it'd work similar to MUI_FINISHPAGE_RUN but instead of being on the finish page, it would appear at the components page.

*note* I think making it a component would work, but I'm not looking to have it part of the component list if possible.
*update* I can get the page to display if I make it as a component, but all the buttons are enabled and it won't let me quit the install...

Any guidance anyone can provide would be a great help.


I'm thinking of 2 custom pages, if specific component which may has advanced config is selected then shows the 1st custom page with a checkbox "enable advanced config" which shows the 2nd custom page with all settings a user may select.
If that specific component isn't selected then skip both pages and go on.


That might work I think but I think I might just opt to always show the page if the components are selected (its only 2 browse boxes and a checkbox which will all be defaulted). I was trying to

I think I'd need to check if the components were selected and then display the page but I'm not sure how to do this. Last time I tried to display a page on the fly like that, all the buttons were disabled (even when I tried to turn them on) and I couldn't close the install at all.


I think I'd need to check if the components were selected and then display the page but I'm not sure how to do this.
I've posted an example the other day that might help you start,

http://forums.winamp.com/showthread....hreadid=264758

Thanks a bunch Red Wine, using your example I think I got it all figured out.


You're welcome!
In the meantime I transfered my imagination about this kind of installer (if I got it right) to a sample script that you might want to take a look over :)

OutFile "Test.exe"
InstallDir "$PROGRAMFILES\boo"

InstType Typical
InstType Full

!include "mui.nsh"
!include "LogicLib.nsh"

!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_COMPONENTSPAGE_SMALLDESC

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_COMPONENTS
Page Custom custcreate1
Page Custom custcreate2 custleave2
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE "English"

Section "common (required)" sec1
SectionIn ro
SectionEnd

Section "some extras" sec2
SectionIn 1 2
SectionEnd

Section /o "stuff with advanced config" sec3
SectionIn 2
SectionEnd

Function custcreate1
push $0
SectionGetFlags ${Sec3} $0
IntOp $0 $0 & 1
${If} $0 == 0
pop $0
Abort
${endIf}
!insertmacro MUI_HEADER_TEXT "Advanced configuration for stuff" \
"Advanced configuration for stuff description."
InstallOptions::Dialog "$PLUGINSDIR\custom1.ini"
pop $0
pop $0
FunctionEnd

Function custcreate2
push $0
ReadINIStr $0 "$PLUGINSDIR\custom1.ini" "field 2" "state"
${If} $0 == 1
SectionGetFlags ${Sec3} $0
IntOp $0 $0 & 1
${AndIf} $0 == 1
${Else}
pop $0
Abort
${EndIf}
!insertmacro MUI_HEADER_TEXT "Advanced configuration for stuff" \
"Advanced configuration for stuff settings."
InstallOptions::Dialog "$PLUGINSDIR\custom2.ini"
pop $0
pop $0
FunctionEnd

Function custleave2
MessageBox MB_OK "checking user's selections and setting required actions"
FunctionEnd

Function .onInit
InitPluginsDir

WriteINIStr "$PLUGINSDIR\custom1.ini" "settings" "numfields" "3"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 1" "type" "groupbox"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 1" "text" "Advanced configuration wizard"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 1" "left" "2"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 1" "right" "-2"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 1" "top" "6"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 1" "bottom" "-1"

WriteINIStr "$PLUGINSDIR\custom1.ini" "field 2" "type" "checkbox"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 2" "text" "Enable Advanced configuration"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 2" "left" "30"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 2" "right" "-3"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 2" "top" "22"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 2" "bottom" "34"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 2" "state" "0"

WriteINIStr "$PLUGINSDIR\custom1.ini" "field 3" "type" "label"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 3" "text" "Advanced configuration description bla bla"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 3" "left" "20"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 3" "right" "-21"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 3" "top" "50"
WriteINIStr "$PLUGINSDIR\custom1.ini" "field 3" "bottom" "-4"

WriteINIStr "$PLUGINSDIR\custom2.ini" "settings" "numfields" "1"
WriteINIStr "$PLUGINSDIR\custom2.ini" "field 1" "type" "groupbox"
WriteINIStr "$PLUGINSDIR\custom2.ini" "field 1" "text" "Advanced configuration settings fields"
WriteINIStr "$PLUGINSDIR\custom2.ini" "field 1" "left" "2"
WriteINIStr "$PLUGINSDIR\custom2.ini" "field 1" "right" "-2"
WriteINIStr "$PLUGINSDIR\custom2.ini" "field 1" "top" "2"
WriteINIStr "$PLUGINSDIR\custom2.ini" "field 1" "bottom" "-2"
FunctionEnd

That's pretty slick man, I really like the !define MUI_COMPONENTSPAGE_SMALLDESC too, I didn't know that existed. I'm currently using it with normal descriptions but I think I like that layout a little bit more. I think the flow on your is not as bad as I expected too.

I thought adding an extra page would make it a little more complicated (I've lost all faith in our customer's technical ability) but it's pretty harmless.