Archive: problem with section name, possible bug


problem with section name, possible bug
hi there!
i've got a problem with unvisible sections. from the docs i know, that sections name are unvisible, if their namestring is empty, or contains a '-' as first character.
so, i've written the following lines:
(i'm using the latest development snapshot from 7. nov.)


#script.nsi
#mainfile, variables and includes
Var BCDIR


# page.nsh
# defining the function, to edit the layout of the componentspage
!define MUI_PAGE_CUSTOMFUNCTION_SHOW PreComponents
!insertmacro MUI_PAGE_COMPONENTS

# functions.nsh
# the function
Function PreComponents
StrCpy $BCDIR ""
StrCpy $R0 ""
ClearErrors

ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\bc42.exe" ""
IfErrors 0 +3
SectionSetText ${f_b} ""
Goto End

SectionSetText ${f_b} "$(files_bc)"
GetFullPathName $BCDIR $R0
End:
FunctionEnd


# sections.nsh
# the section
Section /o "" f_b
SectionIn 2

StrCmp $BCDIR "" 0 +3
StrCpy $R0 "0"
Goto End

Push $OUTDIR
SetOutPath $BCDIR
File /nonfatal /r ".\files_client_full\battlecraft\*.*"
Pop $OUTDIR
StrCpy $R0 "1"

End:
WriteRegDWORD HKLM "Software\${C_COMPANY}\${C_PRODUCT}" "BC1942SupportInstalled" $R0
SectionEnd

#lang.nsh
#langstrings
LangString files_bc ${LANG_ENGLISH} "Plug-in for Battlecraft42"
LangString files_bc ${LANG_GERMAN} "Plug-In für Battlecraft42"


(ive splitted the whole script to 8 files, 7* .nsh + 1* .nsi, so its easier for me to read and write.)


my problem is, that the section wont get unvisible, neither with '-' nor with empty namestring.

ps:
for all nsis-scripters interested in my work: i'm currently scripting a comfortable installer for modifications of the game "battlefield 1942". especially for the stuntfactory modification.

sorry, the description of my problem was uncorrect.
here is the fine version:
- if i define the section with empty name: 'Section ""', it is NEVER shown, even if i change the by 'SectionSetText "abc"'.
- if i define the section with any name: 'Section "abc"', it is ALWAYS shown, even if i change the by 'SectionSetText "-abc"' or 'SectionSetText ""'


Both specifying an empty name directly after Section and using SectionSetText work fine for me. Check your script for logic errors. Also note that a string that contains just an empty LangString is not an empty string, it has a LangString in it.

[edit]Your latest examples work too.[/edit]


I looked at the script again. The problem is that you've defined a show function instead of a pre function. When the show function loads the setion names are already loaded and drawn.