Hi all,
I have a custom page on which there are 2 Radiobuttons, after the selection of the 2 Radiobuttons, a component page shows up, some of the sections will be disabled or enabled based on the Radiobutton selection. How can I set the sections?
From my understanding, there is one way, such as "SectionIn RO", but it is only for compile time but runtime.
And there is another way to do it for runtime, "SetSectionFlag ${SEC_NAM} ${SF_RO}", but I tried to set it either in RadioButton page function (PageLeave) or in the relative section, it does not work.
Can you experts help?
Thanks in advance.
Jue
Disable/enable sections in component page
3 posts
Make sure that code is after the Sections so that the constant ${SEC_NUM} is defined. Also make sure you have included Sections.nsh
Stu
Stu
I've answered in the same question in another thread, here:
In case I misunderstood when you say disabled you mean read only, here is the code:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
In case I misunderstood when you say disabled you mean read only, here is the code:
Function func_pre
ReadINIStr $0 "${CUST_INI}" "field 1" "state"
${If} $0 = 1
SectionGetFlags ${sec1} $R0
Intop $R0 $R0 | ${SF_RO}
SectionSetFlags ${sec1} $R0
SectionSetFlags ${sec2} ${SF_SELECTED}
SectionSetFlags ${sec3} ${SF_SELECTED}
${ElseIf} $0 = 0
ReadINIStr $1 "${CUST_INI}" "field 2" "state"
${AndIf} $1 = 1
SectionGetFlags ${sec2} $R0
Intop $R0 $R0 | ${SF_RO}
SectionSetFlags ${sec2} $R0
SectionSetFlags ${sec1} ${SF_SELECTED}
SectionSetFlags ${sec3} ${SF_SELECTED}
${Else}
SectionGetFlags ${sec3} $R0
Intop $R0 $R0 | ${SF_RO}
SectionSetFlags ${sec3} $R0
SectionSetFlags ${sec1} ${SF_SELECTED}
SectionSetFlags ${sec2} ${SF_SELECTED}
${EndIf}
FunctionEnd
/*
Function func_pre
GetDlgItem $R0 $HWNDPARENT 3
EnableWindow $R0 0
ReadINIStr $0 "${CUST_INI}" "field 1" "state"
${If} $0 = 1
SectionGetFlags ${sec1} $R0
Intop $R0 $R0 | ${SF_RO}
SectionSetFlags ${sec1} $R0
${ElseIf} $0 = 0
ReadINIStr $1 "${CUST_INI}" "field 2" "state"
${AndIf} $1 = 1
SectionGetFlags ${sec2} $R0
Intop $R0 $R0 | ${SF_RO}
SectionSetFlags ${sec2} $R0
${Else}
SectionGetFlags ${sec3} $R0
Intop $R0 $R0 | ${SF_RO}
SectionSetFlags ${sec3} $R0
${EndIf}
FunctionEnd