Old 27th March 2007, 15:44   #1
thek
Member
 
thek's Avatar
 
Join Date: Jun 2006
Location: Austria
Posts: 92
Select Sectiongroup with Radiobutton

Hello
I have a selection Group
with 4 entries

This four entries should behave like radioButtons
So at least one of the RadioButtons have to be selected


The problem is, if I click on the selectionButton of the group
several "Sub"Sections are selected

like in the attached picture (Red marked is the group)

My .onSelChange Function..
code:
Function .onSelChange
!insertmacro StartRadioButtons $Matlabver
!insertmacro RadioButton ${SEC0016}
!insertmacro RadioButton ${SEC0013}
!insertmacro RadioButton ${SEC0014}
!insertmacro RadioButton ${SEC0015}
!insertmacro EndRadioButtons
FunctionEnd

Attached Images
File Type: png nsis_test.png (85.6 KB, 288 views)
thek is offline   Reply With Quote
Old 27th March 2007, 17:32   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
I following example, once you click on a group default settings restored.
code:

; 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"
!include "logiclib.nsh"

;--------------------------------

Name "One Section"
OutFile "one-section.exe"

;--------------------------------

; Pages

Page components

;--------------------------------

; Sections

Section !Required
SectionIn RO
SectionEnd

SectionGroup /e "Group 1" grp1
Section "Group 1 - Option 1" g1o1
SectionEnd

Section /o "Group 1 - Option 2" g1o2
SectionEnd

Section /o "Group 1 - Option 3" g1o3
SectionEnd
SectionGroupEnd

SectionGroup /e "Group 2" grp2
Section "Group 2 - Option 1" g2o1
SectionEnd

Section /o "Group 2 - Option 2" g2o2
SectionEnd

Section /o "Group 2 - Option 3" g2o3
SectionEnd
SectionGroupEnd
;--------------------------------

; Functions

; $1 stores the status of group 1
; $2 stores the status of group 2

Function .onInit

StrCpy $1 ${g1o1} ; Group 1 - Option 1 is selected by default
StrCpy $2 ${g2o1} ; Group 2 - Option 1 is selected by default

FunctionEnd

Function .onSelChange

SectionGetFlags ${grp1} $R0
IntOp $R0 $R0 & ${SF_SELECTED}

${If} $R0 == ${SF_SELECTED}
!insertmacro SelectSection ${g1o1}
!insertmacro UnSelectSection ${g1o2}
!insertmacro UnSelectSection ${g1o3}
${EndIf}

!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${g1o1}
!insertmacro RadioButton ${g1o2}
!insertmacro RadioButton ${g1o3}
!insertmacro EndRadioButtons

SectionGetFlags ${grp2} $R0
IntOp $R0 $R0 & ${SF_SELECTED}

${If} $R0 == ${SF_SELECTED}
!insertmacro SelectSection ${g2o1}
!insertmacro UnSelectSection ${g2o2}
!insertmacro UnSelectSection ${g2o3}
${EndIf}

!insertmacro StartRadioButtons $2
!insertmacro RadioButton ${g2o1}
!insertmacro RadioButton ${g2o2}
!insertmacro RadioButton ${g2o3}
!insertmacro EndRadioButtons

FunctionEnd


Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 28th March 2007, 07:46   #3
thek
Member
 
thek's Avatar
 
Join Date: Jun 2006
Location: Austria
Posts: 92
Problem solved

Hi Red Wine!
Thank you, I found the error
I forgot to reset the Flags
code:
SectionGetFlags ${grp1} $R0
IntOp $R0 $R0 & ${SF_SELECTED}

${If} $R0 == ${SF_SELECTED}
!insertmacro SelectSection ${g1o1}
!insertmacro UnSelectSection ${g1o2}
!insertmacro UnSelectSection ${g1o3}
${EndIf}



But now i have onother question

I want that the click on the Grp Icon' doesn't change the selection..
is this possible?
I used the following code, but i doesn't change the behavior

what I'm doing wrong?
code:
${If} $R0 == ${SF_SELECTED}
${switch} $Matlabver
${Case} ${SEC0016}
!insertmacro SelectSection ${SEC0016}
!insertmacro UnSelectSection ${SEC0013}
!insertmacro UnSelectSection ${SEC0014}
!insertmacro UnSelectSection ${SEC0015}
${Case} ${SEC0013}
!insertmacro SelectSection ${SEC0013}
!insertmacro UnSelectSection ${SEC0016}
!insertmacro UnSelectSection ${SEC0015}
!insertmacro UnSelectSection ${SEC0014}
${Case} ${SEC0014}
!insertmacro SelectSection ${SEC0014}
!insertmacro UnSelectSection ${SEC0016}
!insertmacro UnSelectSection ${SEC0013}
!insertmacro UnSelectSection ${SEC0015}
${Case} ${SEC0015}
!insertmacro SelectSection ${SEC0015}
!insertmacro UnSelectSection ${SEC0016}
!insertmacro UnSelectSection ${SEC0013}
!insertmacro UnSelectSection ${SEC0014}
${Default}
!insertmacro SelectSection ${SEC0016}
!insertmacro UnSelectSection ${SEC0015}
!insertmacro UnSelectSection ${SEC0013}
!insertmacro UnSelectSection ${SEC0014}
${EndSwitch}
${EndIf}

thek is offline   Reply With Quote
Old 28th March 2007, 08:03   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Quote:
I want that the click on the Grp Icon' doesn't change the selection..
is this possible?
I haven't tested something like this so I couldn't confirm, but, as far as I know NSIS, must be possible, just give it some try.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 28th March 2007, 11:37   #5
thek
Member
 
thek's Avatar
 
Join Date: Jun 2006
Location: Austria
Posts: 92
Talking

My first Problem was, that I added one of the section in the radiobutton group to an installtype
This is a NO-NO!!!
but here is a onselchange which solves the problem
simple select the right section when the section grp get activated

code:
Function .onSelChange
SectionGetFlags ${SECGRP0002} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
${If} $R0 == ${SF_SELECTED}
${select} $Matlabver
${Case} ${SEC0016}
!insertmacro SelectSection ${SEC0016}
!insertmacro UnSelectSection ${SEC0013}
!insertmacro UnSelectSection ${SEC0014}
!insertmacro UnSelectSection ${SEC0015}
${Case} ${SEC0013}
!insertmacro SelectSection ${SEC0013}
!insertmacro UnSelectSection ${SEC0016}
!insertmacro UnSelectSection ${SEC0015}
!insertmacro UnSelectSection ${SEC0014}
${Case} ${SEC0014}
!insertmacro SelectSection ${SEC0014}
!insertmacro UnSelectSection ${SEC0016}
!insertmacro UnSelectSection ${SEC0013}
!insertmacro UnSelectSection ${SEC0015}
${Case} ${SEC0015}
!insertmacro SelectSection ${SEC0015}
!insertmacro UnSelectSection ${SEC0016}
!insertmacro UnSelectSection ${SEC0013}
!insertmacro UnSelectSection ${SEC0014}
${Default}
!insertmacro SelectSection ${SEC0016}
!insertmacro UnSelectSection ${SEC0015}
!insertmacro UnSelectSection ${SEC0013}
!insertmacro UnSelectSection ${SEC0014}
${EndSelect}
${EndIf}

!insertmacro StartRadioButtons $Matlabver
!insertmacro RadioButton ${SEC0013}
!insertmacro RadioButton ${SEC0014}
!insertmacro RadioButton ${SEC0015}
!insertmacro RadioButton ${SEC0016}
!insertmacro EndRadioButtons
FunctionEnd

thek is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump