RadioButtons: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
(No difference)

Revision as of 18:43, 28 October 2005

Author: Tu Tong (talk, contrib)


Description

Macros for mutually exclusive section selection.

Usage

  !insertmacro SectionRadioButtons "1" "1,2,3"
 
or
 
  !insertmacro StartRadioButtons 1
    !insertmacro RadioButton 1
    !insertmacro RadioButton 2
    !insertmacro RadioButton 3
  !insertmacro EndRadioButtons
 
or
 
  !insertmacro SectionRadioButtons "${g2o1}" "${g2o1},${g2o2},${g2o3}"
 
or
 
  !insertmacro StartRadioButtons ${g2o1}
    !insertmacro RadioButton ${g2o1}
    !insertmacro RadioButton ${g2o2}
    !insertmacro RadioButton ${g2o3}
  !insertmacro EndRadioButtons

Example

; 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 ".\Sections.nsh"
 
;--------------------------------
 
Name "One Section"
OutFile "one-section.exe"
 
;--------------------------------
 
; Pages
 
Page components
Page instfiles
 
;--------------------------------
 
; Sections
 
Section !Required
  SectionIn RO
SectionEnd
 
Section "Group 1 - Option 1" g1o1
SectionEnd
 
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
 
;--------------------------------
 
; Functions
 
Function .onSelChange
 
  !insertmacro SectionRadioButtons "1" "1,2,3"
;  !insertmacro StartRadioButtons 1
;    !insertmacro RadioButton 1
;    !insertmacro RadioButton 2
;    !insertmacro RadioButton 3
;  !insertmacro EndRadioButtons
 
;  !insertmacro SectionRadioButtons "${g2o1}" "${g2o1},${g2o2},${g2o3}"
  !insertmacro StartRadioButtons ${g2o1}
    !insertmacro RadioButton ${g2o1}
    !insertmacro RadioButton ${g2o2}
    !insertmacro RadioButton ${g2o3}
  !insertmacro EndRadioButtons
 
FunctionEnd