; one-section.nsi
;
; This example demonstrates how to control section selection.
; It allows only one of the sections of a group to be selected.
;--------------------------------
; Section define/macro header file
; See this header file for more info
!include "MUI.nsh"
!include "Sections.nsh"
Name "One Section"
OutFile "one-section.exe"
RequestExecutionLevel user
;--------------------------------
BrandingText "Copyright (C) 2011 alex"
;--------------------------------
; Pages
; »¶ÓÒ³Ãæ
!insertmacro MUI_PAGE_WELCOME
; ×é¼þÑ¡ÔñÒ³Ãæ
!insertmacro MUI_PAGE_COMPONENTS
;Page components
;--------------------------------
; Sections
;Section !Required
; SectionIn RO
;SectionEnd
SubSection "Group 1 - Option 1" g1o1
Section "test1" o1t1
SectionEnd
Section "test2" o1t2
SectionEnd
Section "test3" o1t3
SectionEnd
SubSectionEnd
Section /o "Group 1 - Option 2" g1o2
SectionEnd
Section /o "Group 1 - Option 3" g1o3
SectionEnd
Section "Group 2 - Option 1" g2o1
SectionEnd
Section /o "Group 2 - Option 2" g2o2
SectionEnd
Section /o "Group 2 - Option 3" g2o3
SectionEnd
; °²×°Ä¿Â¼Ñ¡ÔñÒ³Ãæ
!insertmacro MUI_PAGE_DIRECTORY
; °²×°¹ý³ÌÒ³Ãæ
!insertmacro MUI_PAGE_INSTFILES
;!define MUI_PAGE_CUSTOMFUNCTION_SHOW Show
;!define MUI_PAGE_CUSTOMFUNCTION_LEAVE Leave
; °²×°Íê³ÉÒ³Ãæ
!insertmacro MUI_PAGE_FINISH
; °²×°½çÃæ°üº¬µÄÓïÑÔÉèÖÃ
!insertmacro MUI_LANGUAGE "SimpChinese"
;Function Show
;FunctionEnd
;Function Leave
;FunctionEnd
Section -Setup
SectionEnd
Section -AdditionalIcons
SectionEnd
Section -Post
SectionEnd
Section Uninstall
SetAutoClose true
SectionEnd
;--------------------------------
; Functions
; $1 stores the status of group 1
; $2 stores the status of group 2
Function .onInit
#--ÉèÖÃg1o1Ϊֻ¶Á--
SectionGetFlags "${g1o1}" $R0 ; È¡Ô¸¸ÏîµÄ±êÖ¾Öµ
IntOp $R0 $R0 + 15 ; ¼ÓÉÏ 15£¬Ê¹¸¸Ïî±ä³ÉÖ»¶Á
SectionSetFlags "${g1o1}" $R0
; SectionSetFlags ${o1t1} ${SF_SelectED} ; ÉèÖÃÑ¡ÖÐ״̬
; StrCpy $1 ${o1t1} ; Group 1 - Option 1 is selected by default
SectionSetFlags ${g1o3} ${SF_SelectED} ; ÉèÖÃÑ¡ÖÐ״̬
StrCpy $1 ${g1o3} ; Group 1 - Option 1 is selected by default
StrCpy $2 ${g2o2} ; Group 2 - Option 1 is selected by default
FunctionEnd
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${g1o1}
!insertmacro RadioButton ${g1o2}
!insertmacro RadioButton ${g1o3}
!insertmacro EndRadioButtons
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${o1t1}
!insertmacro RadioButton ${o1t2}
!insertmacro RadioButton ${o1t3}
!insertmacro EndRadioButtons
!insertmacro StartRadioButtons $2
!insertmacro RadioButton ${g2o1}
!insertmacro RadioButton ${g2o2}
!insertmacro RadioButton ${g2o3}
!insertmacro EndRadioButtons
FunctionEnd