Archive: Hiding Components


Hiding Components
Hi,

I am trying to hide some components. However when I try to hide a section on the components page I am getting very! strange results.

Below is a stripped down script that illustrates the issue.
I have left away all the contents and the logic that controls wether a section is hidden.

!include "MUI.nsh"
!include Sections.nsh

Name "Hide Components"
OutFile "HideTest.exe"

Function .onInit
; SectionSetText $(sec_rama) ""
SectionSetText $(sec_dama) ""
SectionSetText $(sec_ding) ""
FunctionEnd

!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_FINISH

Section rama sec_rama
Sectionend

Section dama sec_dama
Sectionend

Section dingdong sec_ding
Sectionend

What I wanted to do is: hide sections 'dama' and 'dingdong' by renaming them to "".
What I am getting however is: 'dama' and 'dingdong' are displayed always regardless of which section I tried to hide.

Can anybody tell me what is wrong with my script?
Is there a recommended way to do it that works?

Thanks!

I found it - I had used the wrong kind of brackets (took me several hours to find that out) :-(

Anyway, here is the corrected script:

!include "MUI.nsh"
!include Sections.nsh

Name "Hide Components"
OutFile "HideTest.exe"

;--------------------------------
;Pages

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_FINISH
;--------------------------------
;Sections

Section rama sec_rama
Sectionend

Section dama sec_dama
Sectionend

Section dingdong sec_ding
Sectionend

;--------------------------------
Function .onInit
; SectionSetText ${sec_rama} ""
SectionSetText ${sec_dama} ""
SectionSetText ${sec_ding} ""
FunctionEnd

Note: The .onInit function had to go to the bottom of the script. otherwise it does not seem to know the sections names.