xbarns
28th October 2009 19:26 UTC
Hidden Section gets "deselected"
Hi everyone,
i have a hidden section,
Section -FirstToExecute SEC_FIRSTTOEXECUTE
SectionEnd
and a couple more sections (one more hidden, about 20 or so regular).
Now in some cases that section does not get executed, i could narrow it down to this happening when i change something in the component selection (select an additional section). The Setup can be used to install (previously not installed) components when called a second time, to accomodate this i use a macro that i have "derived" from the "SELECT_UNSECTION" macro from the examples.
!macro DISABLE_SECTION SECTION_NAME SECTION_ID
Push $R0
ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
StrCmp $R0 1 0 next${SECTION_ID}
!insertmacro SetSectionFlag "${SECTION_ID}" ${SF_RO}
!insertmacro ClearSectionFlag "${SECTION_ID}" ${SF_SELECTED}
next${SECTION_ID}:
Pop $R0
!macroend
That macro is called from
!define MUI_PAGE_CUSTOMFUNCTION_PRE "PRE_PAGE_COMPONENTS"
Function PRE_PAGE_COMPONENTS
!insertmacro DISABLE_SECTION "Business Logic (required)" ${SEC_FRAMEWORK}
!insertmacro DISABLE_SECTION "Backup Server" ${SEC_BACKUPSERVER}
!insertmacro DISABLE_SECTION "Deployment Service" ${SEC_DEPLOYMENTSERVICE}
.
.
.
FunctionEnd
I put
Function .onSelChange
SectionGetFlags ${SEC_FIRSTTOEXECUTE} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${SEC_FIRSTTOEXECUTE} $0
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${SEC_FIREBIRDSERVER2}
!insertmacro RadioButton ${SEC_FIREBIRDSERVER264}
!insertmacro EndRadioButtons
FunctionEnd
in (the code is an example from the manual) but it does not help, the section is not executed.
I checked if i accidentally "uncheck" the section "SEC_FIRSTTOEXECUTE" but i don't, i also do not loop through the sections to do anything to them (i have seen you can do that).
Any ideas?
Your help is much appreciated.
Thanks.
xbarns
28th October 2009 22:13 UTC
Well the problem seems to be the RadioButton macros in .onSelChange, if i remark that block everything works wonderful. I have looked at the macros in section.nsh but i have no clue why it would behave like that.
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${SEC_FIREBIRDSERVER2}
!insertmacro RadioButton ${SEC_FIREBIRDSERVER264}
!insertmacro EndRadioButtons
xbarns
28th October 2009 22:21 UTC
*sigh*
i also tried changing the variables in the "keep always selected" part of .onSelChange so it looks like this:
SectionGetFlags ${SEC_FIRSTTOEXECUTE} $R9
IntOp $R9 $R9 | ${SF_SELECTED}
SectionSetFlags ${SEC_FIRSTTOEXECUTE} $R9
but no :(
ChocJunkie
29th October 2009 08:39 UTC
For unselecting a selected section you can use:
SectionGetFlags ${SectionIndex} $R0
IntOp $R0 $R0 & ${SECTION_OFF}
SectionSetFlags ${SectionIndex} $R0
For selecting a unselected section the code is:
SectionGetFlags ${SectionIndex} $R0
IntOp $R0 $R0 ^ ${SF_SELECTED}
SectionSetFlags ${SectionIndex} $R0
I hope it helps you.
jpderuiter
29th October 2009 10:00 UTC
Actually for selecting any section (selected or unselected) use:
SectionGetFlags ${SectionIndex} $R0
IntOp $R0 $R0 | ${SF_SELECTED}
SectionSetFlags ${SectionIndex} $R0
For unselecting any section use:
SectionGetFlags ${SectionIndex} $R0
Intop $R1 ${SF_SELECTED} ~
IntOp $R0 $R0 & $R1
SectionSetFlags ${SectionIndex} $R0
To toggle any section use:
SectionGetFlags ${SectionIndex} $R0
IntOp $R0 $R0 ^ ${SF_SELECTED}
SectionSetFlags ${SectionIndex} $R0
xbarns
29th October 2009 10:44 UTC
jpderuiter:
your example for selecting a section (selected or unselected) is what i need, and its what i got from the manuals, but it doesn't work reliable for me :(
Is there another way to get that "RadioButton" functionality into the components tree, without using the macros?
jpderuiter
29th October 2009 11:54 UTC
Hi xbarns,
I just wanted to correct the post from ChocJunkie.
I don't know another method, as far as I can see you are doing nothing wrong.
Strange that even forcing the selected state in .OnSelChange does not work.
Can you check if that peace of code is actually called (with a messagebox or something)?
xbarns
29th October 2009 12:02 UTC
Hi jpderuiter,
oh :)
I did the Messagebox thingy already it is called :(
MSG
29th October 2009 13:47 UTC
Are you sure you're not using $1 anywhere else? If you are, change the radiobuttons variable to something you don't use.
xbarns
29th October 2009 13:53 UTC
MSG,
well $1 is used quite frequently during that setup (its a rather large setup).
But i have already tried setting a unique variable for this, same result sadly....
Btw. i am using the unicode (2.45) Version of NSIS (i forgot to mention this earlier).