I have an installer set up with 3 sections.
1 is hidden so that it always installs but the others need to be optional.
Is there a way that I can make only 1 section selectable at a time and not allow them to progress without selecting one.?
Thanks
Mike
2 sections, allow one at a time only
3 posts
From the one-section.nsi in the examples folder:
;add at the top add
As for ensureing at least one section is checked, add:
;add at the top add
;add by all your functions
!include "Sections.nsh"
Just make sure your sections are marked like this:
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${SEC01}
!insertmacro RadioButton ${SEC02}
!insertmacro EndRadioButtons
FunctionEnd
...this should make the user only be able to check one or the other section, but not both.
Section /O "Section 1" SEC01
Section /O "Section 2" SEC02
As for ensureing at least one section is checked, add:
;and this function...
;the below line here...
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "ComponentsLeave"
!insertmacro MUI_PAGE_COMPONENTS
Hope this helps.
Function ComponentsLeave
SectionGetFlags "${SEC01}" $0
StrCmp $0 1 End
SectionGetFlags "${SEC02}" $0
StrCmp $0 1 End
MessageBox MB_OK|MB_ICONINFORMATION "You must select at least one section."
Abort
End:
FunctionEnd
Take a look at Examples\one-section.nsi. It sets a similar restriction. Also search the forum, there were plenty of threads with similar problems and scripts to solve them. The Archive or the Wiki probably contain some useful scripts too.
[edit] Or use what Junw posted above.
[edit] Or use what Junw posted above.