Archive: Section


Section
Hi,

..I have some questions....

1.- I have this in my code...

Section "Bmp" scBmp
.....
SectionEnd

Section "P" scP
......
SectionEnd

Section "Doc" scDoc
.....
SectionEnd

Section "Word" scWord
.....
SectionEnd

...I would like to select in my "page custom" one of these sections......the problem is that no matter which my selection is, the program always execute only the first section, even though this one is not selected...

I have tried several ways:
- !insertmacro SelectSection ${scDoc}
- SectionSetFlags ${scDoc} ${SF_SELECTED}
- !insertmacro MUI_* (in this moment i dont remember that code)

Note: The code for selecting the section is in another .nsh


Question 2.- How do I change the watermarked text(Nullsoft Install System v2.35) in the dialogs?


All sections are selected by default. Read up Section again; you need to use the /o switch.

Stu


Thanks for your answer. I have inserted /o, as explained in documentation, but still doesn't work. Any other suggestion?


Make sure that the code to change the section selection is physically below the sections themselves. The section identifiers are actually defines, and if your code to change the selection is too early, the define will have a value of 0, the first section.


Seems similar with something I made a couple of days ago.
Here's an example,

!define CUST_INI "$PLUGINSDIR\custom.ini"
!include Logiclib.nsh
!include Sections.nsh

outfile "test.exe"
showinstdetails show

page custom CreateCustom LeaveCustom
page instfiles

section "" sec1
detailprint "section 1 selected"
sectionend

section /o "" sec2
detailprint "section 2 selected"
sectionend

section /o "" sec3
detailprint "section 3 selected"
sectionend

Function .onInit
InitPluginsDir

WriteINIStr "${CUST_INI}" "Settings" "NumFields" "3"

WriteINIStr "${CUST_INI}" "field 1" "type" "radiobutton"
WriteINIStr "${CUST_INI}" "field 1" "left" "30"
WriteINIStr "${CUST_INI}" "field 1" "right" "-30"
WriteINIStr "${CUST_INI}" "field 1" "top" "40"
WriteINIStr "${CUST_INI}" "field 1" "bottom" "52"
WriteINIStr "${CUST_INI}" "field 1" "Text" "section 1"
WriteINIStr "${CUST_INI}" "field 1" "state" "1"
WriteINIStr "${CUST_INI}" "field 1" "flags" "GROUP"

WriteINIStr "${CUST_INI}" "field 2" "type" "radiobutton"
WriteINIStr "${CUST_INI}" "field 2" "left" "30"
WriteINIStr "${CUST_INI}" "field 2" "right" "-30"
WriteINIStr "${CUST_INI}" "field 2" "top" "60"
WriteINIStr "${CUST_INI}" "field 2" "bottom" "72"
WriteINIStr "${CUST_INI}" "field 2" "Text" "section 2"
WriteINIStr "${CUST_INI}" "field 2" "state" "0"

WriteINIStr "${CUST_INI}" "field 3" "type" "radiobutton"
WriteINIStr "${CUST_INI}" "field 3" "left" "30"
WriteINIStr "${CUST_INI}" "field 3" "right" "-30"
WriteINIStr "${CUST_INI}" "field 3" "top" "80"
WriteINIStr "${CUST_INI}" "field 3" "bottom" "92"
WriteINIStr "${CUST_INI}" "field 3" "Text" "section 3"
WriteINIStr "${CUST_INI}" "field 3" "state" "0"
FunctionEnd

Function CreateCustom
push $0
InstallOptions::Dialog "${CUST_INI}"
pop $0
pop $0
FunctionEnd

Function LeaveCustom
ReadINIStr $0 "${CUST_INI}" "field 1" "state"
${If} $0 = 1
# do nothing
${ElseIf} $0 = 0
ReadINIStr $1 "${CUST_INI}" "field 2" "state"
${AndIf} $1 = 1
!insertmacro UnselectSection ${sec1}
!insertmacro SelectSection ${sec2}
${Else}
!insertmacro UnselectSection ${sec1}
!insertmacro SelectSection ${sec3}
${EndIf}
FunctionEnd

That worked just fine. Thank you all.


Originally posted by jfk
That worked just fine. Thank you all.
told you it was something in !include Sections.nsh ;)