Archive: Do I need a custom page for this ?


Do I need a custom page for this ?
Hi, this is probably a newbie question and admittedly in NSIS I'm quiete new:

I use the modern ui.

I'd like to permit the installer to
- let the user choose where to install the main components
- let the user choose whether or not he/she likes to install additional components
- If additional components are selected for installation the path where to install them should be again selected by the user.

With my little knowledge about NSIS/MUI I got the impression that the installer default pages (no custom pages) have the ability just...
- to let the user choose one install path (e.g. for the main components).
- to permit the user to (de-)select additional components for installation.

So do I really need a custom page to query the install paths for the other components or did I overlook a MUI_PAGE... macro ?


You can insert more than one directory page.
And you can define MUI_DIRECTORYPAGE_VARIABLE (and use it later with SetOutPath).


Var COMPONENTSDIR

!insertmacro MUI_PAGE_DIRECTORY ;OutPath will be $INSTDIR
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_DIRECTORYPAGE_VARIABLE $COMPONENTSDIR
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

Section -main
SetOutPath $INSTDIR
File "MainPoop.exe"
SectionEnd

Section "Additional Components" comps
SetOutPath $COMPONENTSDIR
File "poop.dll"
SectionEnd

Feature request

Originally posted by galil
You can insert more than one directory page.
And you can define MUI_DIRECTORYPAGE_VARIABLE (and use it later with SetOutPath).
Thank you for the quick reply.
Are the other directory pages always shown or is there a way to show them only if the sections are chosen by the user ?
If it is not possible and/or the MUI_PAGE_COMPONENTS is not able to permit the user to define different paths for each component the following feature request might be reasonable:

- add a MUI_PAGE_COMPONENTS_EX which provides an edit field and a button for a "browse folders" dialog to permit the user to change the predefined outpath for the components.

As a suggestion for the design:
Each component in the component page is shown as an item of a tree view which has a check box next to it to permit the component to be selected for installation or not. (Exactly like in MUI_PAGE_COMPONENTS).
Moreover when the user selects an item a button "Advanced Settings" gets enabled which, when pressed, opens another page which comprises the settings for the component (this might be a custom page). The "Advanced Settings" settings dialog for each component is then closed either by "OK" or "Cancel".

What do you think ?

Re: Feature request

Originally posted by Sternenfaenger
Are the other directory pages always shown or is there a way to show them only if the sections are chosen by the user ?
If you want to skip such page you have to check if the section(s) was selected and use Abort in PRE function for that page.
Like this...

Var COMPONENTSDIR

!insertmacro MUI_PAGE_DIRECTORY ;OutPath will be $INSTDIR
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_PAGE_CUSTOMFUNCTION_PRE "pre_componentsdir"
!define MUI_DIRECTORYPAGE_VARIABLE $COMPONENTSDIR
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

Section -main
SetOutPath $INSTDIR
File "MainPoop.exe"
SectionEnd

Section "Additional Components" comps
SetOutPath $COMPONENTSDIR
File "poop.dll"
SectionEnd

Function pre_componentsdir
SectionGetFlags ${comps} $R0
IntOp $R0 $R0 & 1
IntCmp $R0 1 +2
Abort
FunctionEnd


Thank you very much for your reply.
The answer helped me very much.
Rating: Best

Does this forum support rating the answers of the users ?


No, it dosen't.