Archive: Components Problem


Components Problem
I have a main Program and 3 modules for it.
On the componentspage you can choose one, two or all modules.

How can i prevent that a user choose no module? He has to take one at least.

Thanks


I think this would give you an idea how to do it,

outfile 'Components.exe'
InstallDir '$PROGRAMFILES\Components Test'

!include "Sections.nsh"
!include 'mui.nsh'

!define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveComponents
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE "English"

section "!Required Section"
SectionIn RO
SetOutPath '$INSTDIR'
SectionEnd

Section /o "Components 1" sec01
SetOutPath '$INSTDIR\Component 1'
SectionEnd

Section /o "Components 2" sec02
SetOutPath '$INSTDIR\Component 2'
SectionEnd

Section /o "Components 3" sec03
SetOutPath '$INSTDIR\Component 3'
SectionEnd

Function LeaveComponents
SectionGetFlags ${sec01} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 1 skip

SectionGetFlags ${sec02} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 1 skip

SectionGetFlags ${sec03} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 1 skip

MessageBox MB_OK|MB_ICONEXCLAMATION "Please select a Component!"
Abort

skip:
FunctionEnd