Skip to content
⌘ NSIS Forum Archive

Hide section from a function

2 posts

frodelan#

Hide section from a function

Hi, I have a section

Section "PHP" SectionPHP
...
SectionEnd

I have this code in .onInit: SectionSetText ${SectionPHP} "" And the section is hided.

If I put SectionSetText inside a Function which is placed in a .nsh file, and call that function from .onInit - the section is displayed anyway.

Why?
demiller9#
It might be that you hardcoded the sectionId and the include function comes before the section. The constant 'SectionPHP' gets defined when the Section is compiled; you cannot reference the defined name ${SectionPHP} before that.

If you don't want to put the function below the sections (ie, have the nsh included after the sections), you can pass the ${SectionPHP} value to the function when you call it.