;"only" and "must" one section is selected.
;----------------------

;--------------------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------

; Section define/macro header file
; See this header file for more info

!include "Sections.nsh"

;------------------------------------------------ by razor_x
!include "setsections.nsh"

;--------------------------------
;General

;Name and file
!define APPNAME "istest"
!define APPNAMEANDVERSION "v1.0"
Name "${APPNAMEANDVERSION}"
OutFile "istest.exe"

;Default installation folder
InstallDir "$DESKTOP\istest" 
InstallDirRegKey HKLM "Software\${APPNAME}" ""
;--------------------------------

;--------------------------------
;Interface Configuration


!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_COMPONENTSPAGE_TEXT_COMPLIST ""
!define MUI_COMPONENTSPAGE_TEXT_INSTTYPE ""
;--------------------------------
;Pages

!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections

;Set Section properties
SetOverwrite on

ShowInstDetails "show"
;--------------------------------

Section !Required
  SectionIn RO
SectionEnd

SubSection /e "color" "subs"

Section /o "red" SEC1
SectionEnd
;--------------------------------
Section /o "blue" SEC2
SectionEnd
;--------------------------------
Section /o "green" SEC3
SectionEnd
;--------------------------------
Section "gray" SEC4
SectionEnd
SubSectionEnd
;-------------------------------------------------------

;Problem!!!!
;the following code from "star" to "end" is to make one section "must" and "only" be selected,but it does not work well.
;--------------------------------start

; Functions

; $1 stores the status

;Function .onInit

  ;StrCpy $1 ${SEC1}

;FunctionEnd
;--------------------------------
;Function .onSelChange

  ;!insertmacro StartRadioButtons $1
    ;!insertmacro RadioButton ${SEC1}
    ;!insertmacro RadioButton ${SEC2}
    ;!insertmacro RadioButton ${SEC3}
    ;!insertmacro RadioButton ${SEC4}
  ;!insertmacro EndRadioButtons

;FunctionEnd
;--------------------------------end



;------------------------code by razor_x ---------------- start
Function .OnSelChange
call setsections
FunctionEnd
;------------------------code by  razor_x ------------------  end