From 737da256106063a7d8dae3577d5e5e9000eaa56a Mon Sep 17 00:00:00 2001 From: kichik Date: Sat, 28 Oct 2006 15:28:47 +0000 Subject: [PATCH] emphasize that section_idx is a !define git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4786 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/sections.but | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Docs/src/sections.but b/Docs/src/sections.but index 46e11457..eb525ac4 100644 --- a/Docs/src/sections.but +++ b/Docs/src/sections.but @@ -24,7 +24,7 @@ Tells the installer that the current section needs an additional "size_kb" kilob \c [/o] [([!]|[-])section_name] [section_index_output] -Begins and opens a new section. If section_name is empty, omitted, or begins with a -, then it is a hidden section and the user will not have the option of disabling it. If the section name is 'Uninstall' or is prefixed with 'un.', then it is a an uninstaller section. If \e{section_index_output} is specified, the parameter will be !defined with the section index (that can be used for \R{sectionsettext}{SectionSetText} etc). If the section name begins with a !, the section will be displayed as bold. If the /o switch is specified, the section will be unselected by default. +Begins and opens a new section. If section_name is empty, omitted, or begins with a -, then it is a hidden section and the user will not have the option of disabling it. If the section name is 'Uninstall' or is prefixed with 'un.', then it is a an uninstaller section. If \e{section_index_output} is specified, the parameter will be \R{define}{!defined} with the section index (that can be used for \R{sectionsettext}{SectionSetText} etc). If the section name begins with a !, the section will be displayed as bold. If the /o switch is specified, the section will be unselected by default. \c Section "-hidden section" \c SectionEnd @@ -41,6 +41,32 @@ Begins and opens a new section. If section_name is empty, omitted, or begins wit \c Section "install something" SEC_IDX \c SectionEnd +To access the section index, curly brackets must be used and the code must be located below the section in the script. + +\c Section test1 sec1_id +\c SectionEnd +\c +\c Section test2 sec2_id +\c SectionEnd +\c +\c Function .onInit +\c SectionGetText ${sec2_id} $0 +\c MessageBox MB_OK "name of ${sec2_id}:$\n$0" # will correctly display 'name of 1: test2' +\c FunctionEnd + +\c Function .onInit +\c SectionGetText ${sec2_id} $0 +\c MessageBox MB_OK "name of ${sec2_id}:$\n$0" # will incorrectly display 'name of ${sec2_id}: test1' +\c # plus a warning stating: +\c # unknown variable/constant "{sec2_id}" detected, ignoring +\c FunctionEnd +\c +\c Section test1 sec1_id +\c SectionEnd +\c +\c Section test2 sec2_id +\c SectionEnd + \S2{ssectionend} SectionEnd This command closes the current open section.