Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Components Problem (http://forums.winamp.com/showthread.php?t=273897)

aemik 5th July 2007 07:05

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

Red Wine 5th July 2007 11:40

I think this would give you an idea how to do it,
code:
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



All times are GMT. The time now is 04:32.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.