Is there a way to disable the ability to chose more than 1 component everytime someone wants to do the install.
Reason being, as this is acting as a 4 in 1 installer, and they should only be able to install 1 at a time.
Thanks,
Ryan
Only allowing 1 component per install?
7 posts
You can use .onSelChange (Manual chapter 4.7.2.1.8).
This function is called when the user changes the selection.
Then find out which component is selected with SectionGetFlags (Manual chapter 4.9.13.2).
(You have to remember what component was selected previously).
Then use SectionSetFlags to select this component only.
This function is called when the user changes the selection.
Then find out which component is selected with SectionGetFlags (Manual chapter 4.9.13.2).
(You have to remember what component was selected previously).
Then use SectionSetFlags to select this component only.
Check out Examples\one-section.nsi
Stu
Stu
This is what I have so far, its working for the most part. The only problem I am having, is that I need the default to be all "off/unselected" rather than all selected from the start.
Ideas? Here is my code
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
StrCpy $1 ${SEC01} ; Group 1 - Option 1 is selected by default
StrCpy $2 ${SEC02}
StrCpy $3 ${SEC03}
StrCpy $4 ${SEC04}
FunctionEnd
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${SEC01}
!insertmacro RadioButton ${SEC02}
!insertmacro RadioButton ${SEC03}
!insertmacro RadioButton ${SEC04}
!insertmacro EndRadioButtons
FunctionEnd
Ideas? Here is my code
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
StrCpy $1 ${SEC01} ; Group 1 - Option 1 is selected by default
StrCpy $2 ${SEC02}
StrCpy $3 ${SEC03}
StrCpy $4 ${SEC04}
FunctionEnd
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${SEC01}
!insertmacro RadioButton ${SEC02}
!insertmacro RadioButton ${SEC03}
!insertmacro RadioButton ${SEC04}
!insertmacro EndRadioButtons
FunctionEnd
OK, I didn't know about these macro's.
Makes it easier ;-)
Well, obviously you have to make all sections unselected by default, by adding the /o flag for each section:
This is where the previous selected section is stored.
Makes it easier ;-)
Well, obviously you have to make all sections unselected by default, by adding the /o flag for each section:
BTW, you only need to have ${SEC01} copied to $1 in onInit.; Sections
Section /o "Option 1" SEC01
SectionEnd
Section /o "Option 2" SEC02
SectionEnd
Section /o "Option 3" SEC03
SectionEnd
Section /o "Option 4" SEC04
SectionEnd
;--------------------------------
; Functions
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
StrCpy $1 ${SEC01} ; Group 1 - Option 1 is selected by default
FunctionEnd
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${SEC01}
!insertmacro RadioButton ${SEC02}
!insertmacro RadioButton ${SEC03}
!insertmacro RadioButton ${SEC04}
!insertmacro EndRadioButtons
FunctionEnd
This is where the previous selected section is stored.
Got it, all I needed to do was add the /o!
Thanks!
Thanks!
One problem there is once the user has clicked one of the components he's forced to install one of them. You may want to add an additional empty section in the group that the user can select.
Stu
Stu