Old 7th January 2005, 10:38   #1
billybillybob
Junior Member
 
Join Date: Jan 2005
Posts: 8
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?
billybillybob is offline   Reply With Quote
Old 7th January 2005, 10:56   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 25th September 2012, 16:43   #3
Seban
Junior Member
 
Join Date: Sep 2012
Posts: 14
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
Seban is offline   Reply With Quote
Old 25th September 2012, 18:30   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Put the function after all sections then you can use ${If} ${SectionIsSelected} to check the section states.

Stu
Afrow UK is offline   Reply With Quote
Old 25th September 2012, 20:52   #5
Seban
Junior Member
 
Join Date: Sep 2012
Posts: 14
Hey Afrow, thanks for the quick answer. I'm going to try this tomorrow.

Thanks a lot!
Seban is offline   Reply With Quote
Old 26th September 2012, 11:42   #6
Seban
Junior Member
 
Join Date: Sep 2012
Posts: 14
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
Attached Files
File Type: nsi toForum.nsi (2.9 KB, 101 views)
Seban is offline   Reply With Quote
Old 26th September 2012, 11:59   #7
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
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).
jpderuiter is offline   Reply With Quote
Old 26th September 2012, 12:22   #8
Seban
Junior Member
 
Join Date: Sep 2012
Posts: 14
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.
Seban is offline   Reply With Quote
Old 26th September 2012, 12:26   #9
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
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.
demiller9 is offline   Reply With Quote
Old 26th September 2012, 14:12   #10
Seban
Junior Member
 
Join Date: Sep 2012
Posts: 14
It's me again

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.
Attached Files
File Type: nsi toForum.nsi (2.9 KB, 94 views)
Seban is offline   Reply With Quote
Old 25th October 2012, 02:00   #11
Seban
Junior Member
 
Join Date: Sep 2012
Posts: 14
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:
code:
!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.
code:
!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.
code:
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:
code:
; 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.
Attached Files
File Type: nsi Custom_Summary_Page.nsi (3.5 KB, 100 views)
Seban is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump