Archive: Review page before installing


Review page before installing
I would like to make up a review page that lists all the things a user selected during the install - sections, install path, shortcut folder, custom page info. This page would be the last page before installing so a user can look over what they selected before installing.

This was a neat feature on the myinno installer I used before and I miss it. Anyone know of a good way to do this?


You can create an InstallOptions page and fill the information in it before you actually show the page. Have a look at Examples\Modern UI\InstallOptions.nsi. In there, before the insertion of the MUI_INSTALLOPTIONS_DISPLAY macro, add some MUI_INSTALLOPTIONS_WRITE macros to change the INI so the page will display the required information.


Hello,

I'm trying to create an overview screen to show the install settings, just like described in the op. I used MUI2.nsh to create the standard pages and nsDialogs.nsh to create a custom page:

Function MUI_PAGE_OVERVIEW
; Create page
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}

; Set page- & subtitel
!insertmacro MUI_HEADER_TEXT $(page_titel) $(page_subtitel)

; Add controls to page
${NSD_CreateLabel} 0 0 100% 12u $(overview_label)
Pop $Label
${NSD_CreateText} 0 13u 100% -13u $(overview_text)
Pop $Text

; Show page
nsDialogs::Show
FunctionEnd


One problem is, I want to write the chosen components into the text field but don't know how to. I tried variables that I assigned in the sections, but they probably are assigned after the custom page function is called.

Is there an easy way to realize this?
Is what kichik wrote still up to date? I read the InstallOptions plug in is outdated and the post is 7 years old. How is this done nowadays?

Thanks in advance,
Seban


Put the function after all sections then you can use ${If} ${SectionIsSelected} to check the section states.

Stu


Hey Afrow, thanks for the quick answer. I'm going to try this tomorrow.

Thanks a lot!


Hi Stu,

I tried this, but it doesn't work. I attached a slimmed down copy of my .nsi file, maybe you or someone else is willing to take a look at it.

The script doesn't copy/delete anything, it just shows two message boxes. ;)

Thanks


Use ${If} ${SectionIsSelected} as Afrow said instead of setting a global var in a section (what you do is mixing compile time and runtime functions, which you shouldn't).


I see, I didn't get that {SectionIsSelected} is a special command from LogicLib.nsh.

I got it to work now.

Thank you very much.


The sections wont be executed, and the variable won't be assigned, until the InstFiles page is shown and the Install button has been pressed. That's too late to let you use the variable in your Overview page. As they all say, use ${If} ${SectionIsSelected}.

@jpderuiter: Seban is not mixing runtime and compile time instructions. His code is all properly written with runtime instructions.


It's me again :D

I have another problem and can't find a solution (probably because I'm a noob as you may have realized yet):
In line 126 I use the LangString $(overview_text) to write into the text box. I want to change $(overview_text) depending on the components the user chose. I had some ideas but none of them worked, besides they all seemed very questionable to me in the first place.

How can I fill the text box depending on the chosen components (and in min. 2 different languages)?

I attached the slimmed down .nsi again (the previous problem corrected)

Isn't there a tutorial on how to create such an overview page? Everything else was very easy & well documented so far, but I can't find a how to or a sample for this.


Hello,

I created a simple custom summary page for my installer. It shows the destination folder and the chosen components. Maybe someone can use this some day. Keep in mind that this is the first installer I ever created so this might not be perfectly coded, but it works fine in my installer. Nevertheless no warranties and stuff ;) Feel free to post improvements and/or corrections.


Add these includes at the top of your script:

!include MUI2.nsh               ; Modern UI
!include nsDialogs.nsh ; Create custom pages
!include WinMessages.nsh ; Have all of Windows messages defined in the script
!include LogicLib.nsh ; Provide macros that allow easy construction of complex logical structures


Add the page where you want it to be shown, e.g.
!insertmacro MUI_PAGE_DIRECTORY
Page custom mui_page_summary
!insertmacro MUI_PAGE_INSTFILES


Create some language strings that you want to display, e.g. I suggest saving them in a .nsh-file and include it to keep the srcipt more readable.
LangString summary_page_title ${LANG_ENGLISH} "Summary"
LangString summary_page_subtitle ${LANG_ENGLISH} "Ready to start installing MySoftware."
LangString summary_label_path ${LANG_ENGLISH} "MySoftware will be installed to the following location:"
LangString summary_text_path ${LANG_ENGLISH} "$INSTDIR"
LangString summary_label_components ${LANG_ENGLISH} "The following components will be installed:"
LangString summary_Comp1 ${LANG_ENGLISH} "Component 1"
LangString summary_Comp2 ${LANG_ENGLISH} "Component 2"
LangString summary_Comp3 ${LANG_ENGLISH} "Component 3"
LangString summary_label_info ${LANG_ENGLISH} "Click Install to continue."


Add the following function behind your sections and customize it so it meets your expectations:
; Create custom summary page
Function mui_page_summary
; Variables
Var /GLOBAL Dialog
Var /GLOBAL lblPath
Var /GLOBAL txtPath
Var /GLOBAL lblComponents
Var /GLOBAL chkComp1
Var /GLOBAL lblComp1
Var /GLOBAL chkComp2
Var /GLOBAL lblComp2
Var /GLOBAL chkComp3
Var /GLOBAL lblComp3
Var /GLOBAL lblInfo

; Create page
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}

; Set page title & subtitle
!insertmacro MUI_HEADER_TEXT $(summary_page_title) $(summary_page_subtitle)

; Add controls to page
; Controls to show destination folder
${NSD_CreateLabel} 0 0 100% 12u $(summary_label_path)
Pop $lblPath
${NSD_CreateText} 0 13u 100% 12u $(summary_text_path)
Pop $txtPath
; Set text control to read-only
SendMessage $txtPath ${EM_SETREADONLY} 1 0 ; Needs WinMessages.nsh

; Controls to show components, checkboxes enabled if components are chosen
${NSD_CreateLabel} 0 31u 100% 12u $(summary_label_components)
Pop $lblComponents

${NSD_CreateCheckBox} 1 41u 10u 12u ""
Pop $chkComp1
${If} ${SectionIsSelected} ${SECTION1}
${NSD_Check} $chkComp1
${EndIf}
; Disable checkbox (so it can't be checked/unchecked)
EnableWindow $chkComp1 0
${NSD_CreateLabel} 11u 43u 100% 12u $(summary_Comp1)
Pop $lblComp1

${NSD_CreateCheckBox} 1 52u 10u 12u ""
Pop $chkComp2
${If} ${SectionIsSelected} ${SECTION2}
${NSD_Check} $chkComp2
${EndIf}
EnableWindow $chkComp2 0
${NSD_CreateLabel} 11u 54u 100% 12u $(summary_Comp2)
Pop $lblComp2

${NSD_CreateCheckBox} 1 63u 10u 12u ""
Pop $chkComp3
${If} ${SectionIsSelected} ${SECTION3}
${NSD_Check} $chkComp3
${EndIf}
EnableWindow $chkComp3 0
${NSD_CreateLabel} 11u 65u 100% 12u $(summary_Comp3)
Pop $lblComp3

; Controls to show info
${NSD_CreateLabel} 0 -16u 100% 12u $(summary_label_info)
Pop $lblInfo

; Show custom page
nsDialogs::Show
FunctionEnd


These following websites have been very helpful:
http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html
http://nsis.sourceforge.net/NsDialogs_FAQ
http://nsis.sourceforge.net/Docs/Mod...UI/Readme.html

The code can also be found in the attached .nsi-file.