Vankov
23rd July 2009 11:31 UTC
Turn off sections on runtime
Turn off sections on runtime
I have a problem :
Section "VerifyEnvironment"
${If} $CommandLine == '/admin'
messageBox MB_OK "/admin"
${Else}
SectionIn RO
${EndIf}
CommandLine is "/admin" but section is read-only!If i continue install the messageBox is show!!!:confused:
Please help!:up:
Afrow UK
23rd July 2009 12:02 UTC
SectionIn is not a run time instruction therefore you section will be disabled unconditionally.
Are you trying to unselect the section or make it read only? To unselect it, use the UnselectSection macro in Sections.nsh. To make it read only, use the SetSectionFlag macro with ${SF_RO}.
Note: These must be done prior to the Components page.
Stu
Vankov
23rd July 2009 13:28 UTC
i have:
SectionGroup "Prerequisits (Required)" sec
Section "VerifyEnvironment" sec1
......
and i use :
insertmacro SetSectionFlag ${sec} ${SF_RO}
!insertmacro SetSectionFlag ${sec1} ${SF_RO}
!insertmacro SetSectionFlag ${sec2} ${SF_RO}
and the results is - only SectionGroup is read-only!!:confused: and i can make it check box 1/0(mark or unmark) with sec1,sec2 ....
Vankov
27th July 2009 13:55 UTC
please help!
Afrow UK
27th July 2009 17:28 UTC
Where have you put this code? As I have already said, you need to use it before the components and instfiles pages. That could be in .onInit or a page PRE function.
Stu
demiller9
27th July 2009 18:12 UTC
And the code has to be *below* the section defines - otherwise the ${sec1} - ${secN} values are not defined. Not defined is like "0" which is probably the value of ${sec} and explains how the group gets turned into RO.
Vankov
29th July 2009 09:39 UTC
Originally posted by demiller9
And the code has to be *below* the section defines
Now is ok!10x!