home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Programming / nsis-2.46-setup.exe / Examples / one-section.nsi < prev    next >
Encoding:
Text File  |  2008-01-27  |  1.5 KB  |  79 lines

  1. ; one-section.nsi
  2. ;
  3. ; This example demonstrates how to control section selection.
  4. ; It allows only one of the sections of a group to be selected.
  5.  
  6. ;--------------------------------
  7.  
  8. ; Section define/macro header file
  9. ; See this header file for more info
  10.  
  11. !include "Sections.nsh"
  12.  
  13. ;--------------------------------
  14.  
  15. Name "One Section"
  16. OutFile "one-section.exe"
  17. RequestExecutionLevel user
  18.  
  19. ;--------------------------------
  20.  
  21. ; Pages
  22.  
  23. Page components
  24.  
  25. ;--------------------------------
  26.  
  27. ; Sections
  28.  
  29. Section !Required
  30.   SectionIn RO
  31. SectionEnd
  32.  
  33. Section "Group 1 - Option 1" g1o1
  34. SectionEnd
  35.  
  36. Section /o "Group 1 - Option 2" g1o2
  37. SectionEnd
  38.  
  39. Section /o "Group 1 - Option 3" g1o3
  40. SectionEnd
  41.  
  42. Section "Group 2 - Option 1" g2o1
  43. SectionEnd
  44.  
  45. Section /o "Group 2 - Option 2" g2o2
  46. SectionEnd
  47.  
  48. Section /o "Group 2 - Option 3" g2o3
  49. SectionEnd
  50.  
  51. ;--------------------------------
  52.  
  53. ; Functions
  54.  
  55. ; $1 stores the status of group 1
  56. ; $2 stores the status of group 2
  57.  
  58. Function .onInit
  59.  
  60.   StrCpy $1 ${g1o1} ; Group 1 - Option 1 is selected by default
  61.   StrCpy $2 ${g2o1} ; Group 2 - Option 1 is selected by default
  62.  
  63. FunctionEnd
  64.  
  65. Function .onSelChange
  66.  
  67.   !insertmacro StartRadioButtons $1
  68.     !insertmacro RadioButton ${g1o1}
  69.     !insertmacro RadioButton ${g1o2}
  70.     !insertmacro RadioButton ${g1o3}
  71.   !insertmacro EndRadioButtons
  72.     
  73.   !insertmacro StartRadioButtons $2
  74.     !insertmacro RadioButton ${g2o1}
  75.     !insertmacro RadioButton ${g2o2}
  76.     !insertmacro RadioButton ${g2o3}
  77.   !insertmacro EndRadioButtons
  78.     
  79. FunctionEnd