new example
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3309 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
a6046b428a
commit
48fcee1824
1 changed files with 53 additions and 49 deletions
|
@ -1,74 +1,78 @@
|
||||||
# This example demonstrates how to control section selection.
|
; one-section.nsi
|
||||||
# It allows only one of the four optional section to be
|
;
|
||||||
# selected at any given time.
|
; This example demonstrates how to control section selection.
|
||||||
|
; It allows only one of the sections of a group to be selected.
|
||||||
|
|
||||||
#############################################################
|
;--------------------------------
|
||||||
# New macros which make this so much easier can be found in #
|
|
||||||
# Include\Sections.nsh. #
|
|
||||||
#############################################################
|
|
||||||
|
|
||||||
#### Uncomment the next line for an example with subsections too
|
; Section define/macro header file
|
||||||
# !define USE_SUBSECTION
|
; See this header file for more info
|
||||||
####
|
|
||||||
|
|
||||||
Name example
|
!include "Sections.nsh"
|
||||||
OutFile one-section.exe
|
|
||||||
|
;--------------------------------
|
||||||
|
|
||||||
|
Name "One Section"
|
||||||
|
OutFile "one-section.exe"
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
|
||||||
|
; Pages
|
||||||
|
|
||||||
Page components
|
Page components
|
||||||
|
|
||||||
# defines SF_*, SECTION_OFF and some macros
|
;--------------------------------
|
||||||
!include Sections.nsh
|
|
||||||
|
; Sections
|
||||||
|
|
||||||
Section !Required
|
Section !Required
|
||||||
SectionIn RO
|
SectionIn RO
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
!ifdef USE_SUBSECTION
|
Section "Group 1 - Option 1" g1o1
|
||||||
SubSection /e "choose one" subsec
|
|
||||||
!endif
|
|
||||||
|
|
||||||
Section "optional #1" sec1
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section /o "optional #2" sec2
|
Section /o "Group 1 - Option 2" g1o2
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section /o "optional #3" sec3
|
Section /o "Group 1 - Option 3" g1o3
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section /o "optional #4" sec4
|
Section "Group 2 - Option 1" g2o1
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
!ifdef USE_SUBSECTION
|
Section /o "Group 2 - Option 2" g2o2
|
||||||
SubSectionEnd
|
SectionEnd
|
||||||
!endif
|
|
||||||
|
Section /o "Group 2 - Option 3" g2o3
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
|
||||||
|
; Functions
|
||||||
|
|
||||||
|
; $1 stores the status of group 1
|
||||||
|
; $2 stores the status of group 2
|
||||||
|
|
||||||
Function .onInit
|
Function .onInit
|
||||||
StrCpy $1 ${sec1} ; Gotta remember which section we are at now...
|
|
||||||
|
StrCpy $1 ${g1o1} ; Group 1 - Option 1 is selected by default
|
||||||
|
StrCpy $1 ${g2o1} ; Group 2 - Option 1 is selected by default
|
||||||
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function .onSelChange
|
Function .onSelChange
|
||||||
!ifdef USE_SUBSECTION
|
|
||||||
; Check if the user have selected all of the sections using the sub-section
|
|
||||||
; This piece of code is not needed when there are only two sections
|
|
||||||
Push $0
|
|
||||||
|
|
||||||
SectionGetFlags ${subsec} $0
|
|
||||||
IntOp $0 $0 & ${SF_SELECTED}
|
|
||||||
StrCmp $0 0 skip
|
|
||||||
SectionSetFlags ${sec1} 0
|
|
||||||
SectionSetFlags ${sec2} 0
|
|
||||||
SectionSetFlags ${sec3} 0
|
|
||||||
SectionSetFlags ${sec4} 0
|
|
||||||
skip:
|
|
||||||
|
|
||||||
Pop $0
|
|
||||||
!endif
|
|
||||||
|
|
||||||
!insertmacro StartRadioButtons $1
|
!insertmacro StartRadioButtons $1
|
||||||
!insertmacro RadioButton ${sec1}
|
!insertmacro RadioButton ${g1o1}
|
||||||
!insertmacro RadioButton ${sec2}
|
!insertmacro RadioButton ${g1o2}
|
||||||
!insertmacro RadioButton ${sec3}
|
!insertmacro RadioButton ${g1o3}
|
||||||
!insertmacro RadioButton ${sec4}
|
!insertmacro EndRadioButtons
|
||||||
!insertmacro EndRadioButtons
|
|
||||||
|
!insertmacro StartRadioButtons $2
|
||||||
|
!insertmacro RadioButton ${g2o1}
|
||||||
|
!insertmacro RadioButton ${g2o2}
|
||||||
|
!insertmacro RadioButton ${g2o3}
|
||||||
|
!insertmacro EndRadioButtons
|
||||||
|
|
||||||
FunctionEnd
|
FunctionEnd
|
Loading…
Add table
Add a link
Reference in a new issue