- NSIS Discussion
- !insert macro radiobuttons
Archive: !insert macro radiobuttons
razor_x
12th August 2004 21:53 UTC
!insert macro radiobuttons
!insertmacro radiobuttons makes some buggy behavior...
for example when i use a subsection i have to use something like this or all sections are enabled when subsection is checked.
Function .onselchange
!insertmacro SectionFlagIsSet ${EX} ${SF_SELECTED} selectedEX noEX
selectedEX:
!insertmacro UnselectSection ${EX1}
!insertmacro UnselectSection ${EX2}
!insertmacro UnselectSection ${EX3}
!insertmacro UnselectSection ${EX4}
!insertmacro UnselectSection ${EX5}
!insertmacro UnselectSection ${EX6}
!insertmacro UnselectSection ${EX7}
noEX:
FunctionEnd
then if i want to add radio button function to those sectiones with...
Function .onselchange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${EX1}
!insertmacro RadioButton ${EX2}
!insertmacro RadioButton ${EX3}
!insertmacro RadioButton ${EX4}
!insertmacro RadioButton ${EX5}
!insertmacro RadioButton ${EX6}
!insertmacro RadioButton ${EX7}
!insertmacro EndRadioButtons
!insertmacro SectionFlagIsSet ${EX} ${SF_SELECTED} selectedEX noEX
selectedEX:
!insertmacro UnselectSection ${EX1}
!insertmacro UnselectSection ${EX2}
!insertmacro UnselectSection ${EX3}
!insertmacro UnselectSection ${EX4}
!insertmacro UnselectSection ${EX5}
!insertmacro UnselectSection ${EX6}
!insertmacro UnselectSection ${EX7}
noEX:
FunctionEnd
it appears to work unless the subsection is checked again for some reason..the the radiobuttons have very strange behavior,seemingly ramdom section selection etc.is there a better way to do this?
razor_x
13th August 2004 03:02 UTC
posting a simple example..is there a way to control the sections that are selected in a subsection...the radio buttons are'nt working well for me,whats wrong?
razor_x
13th August 2004 06:25 UTC
nvm got it working finally.
ppppppp
30th August 2004 09:40 UTC
who can modify the test.nis to make one example "must" and "only" be selected.
thanks very much!
ddod
9th August 2005 19:05 UTC
I am having some wierd behaviour also.
I only have three sections. When I use the following code:
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${SEC01}
!insertmacro RadioButton ${SEC02}
!insertmacro RadioButton ${SEC03}
!insertmacro EndRadioButtons
FunctionEnd
It kind of works right.
What happens is this. When the components page is first appears, the first section is checked. I click on section 2 and it is checked (section one, however, remains checked also). I click on section three and it is checked (section two gets unchecked but section one still remains checked).
If I select and then deselect any section then everything begins to function normally.
This is not good because this introduces the possiblity that someone might have two sections checked. What am I missing?
Thanks again.
kichik
9th August 2005 19:14 UTC
Seems like you forgot to initialize $1.
ddod
9th August 2005 20:00 UTC
I did, in the oninit function I call
StrCpy $1 ${SEC01}
Shouldn't that work. It worked fine until I added the third section.
kichik
9th August 2005 20:02 UTC
Then ${SEC01} must not be defined in .onInit. It'll be easier to debug with the complete script...
ddod
10th August 2005 15:33 UTC
I moved the initialation to onguiinit function and it started working again. Thanks for the help in the right direction. It was strange, it was working fine the other way under windows 98 but not under NT.
By the way I would have responded earlier but I couldn't get into the forums all afternoon yesterday. It seems the site was down.
NHOCSUNG
10th August 2005 23:56 UTC
This is a better way to do the radio button
Function .onselchange
!insertmacro StartRadioButtons $1
${For} $R1 1 6
!insertmacro RadioButton $R1
${Next}
!insertmacro EndRadioButtons
${If} ${SectionIsSelected} ${EX}
${For} $R1 1 6
!insertmacro UnselectSection $R1
${Next}
${EndIf}
Functionend
no comment