Debian Codegraph @

Docs/src/sec.but

raw
1 \S1{secmanage} Section Management
2
3 \S2{sectionsetflags} SectionSetFlags
4
5 \c section_index section_flags
6
7 Sets the section's flags. The flag is a 32-bit integer. The first bit (lowest) represents whether the section is currently selected, the second bit represents whether the section is a section group (don't modify this unless you really know what you are doing), the third bit represents whether the section is a section group end (again, don't modify), the fourth bit represents whether the section is shown in bold or not, the fifth bit represents whether the section is read-only, the sixth bit represents whether the section group is to be automatically expanded, the seventh bit is set for section groups which are partially selected, the eighth bit is internally used for partially selected section group toggling and the ninth bit is used for reflecting section name changes. The error flag will be set if an out of range section is specified.
8
9 Each flag has a name, prefixed with `SF_`:
10
11 \c !define SF_SELECTED 1
12 \c !define SF_SECGRP 2
13 \c !define SF_SECGRPEND 4
14 \c !define SF_BOLD 8
15 \c !define SF_RO 16
16 \c !define SF_EXPAND 32
17 \c !define SF_PSELECTED 64
18
19 For an example of usage please see the \L{../Examples/one-section.nsi}{one-section.nsi} example.
20
21 For more useful macros and definitions, see Include\\Sections.nsh.
22
23 \c Section test test_section_id
24 \c SectionEnd
25 \c
26 \c Function .onInit
27 \c # set section 'test' as selected and read-only
28 \c IntOp $0 ${SF_SELECTED} | ${SF_RO}
29 \c SectionSetFlags ${test_section_id} $0
30 \c FunctionEnd
31
32 \S2{sectiongetflags} SectionGetFlags
33
34 \c section_index user_var(output)
35
36 Retrieves the section's flags. See SectionSetFlags for a description of the flags. The error flag will be set if an out of range section is specified.
37
38 \c Section test test_section_id
39 \c SectionEnd
40 \c
41 \c Function .onSelChange
42 \c # keep section 'test' selected
43 \c SectionGetFlags ${test_section_id} $0
44 \c IntOp $0 $0 | ${SF_SELECTED}
45 \c SectionSetFlags ${test_section_id} $0
46 \c FunctionEnd
47
48 \S2{sectionsettext} SectionSetText
49
50 \c section_index section_text
51
52 Sets the description for the section section_index. If the text is set to "" then the section will be hidden. The error flag will be set if an out of range section is specified.
53
54 \c Section "" test_section_id
55 \c SectionEnd
56 \c
57 \c Function .onInit
58 \c # change section's name to $WINDIR
59 \c SectionSetText ${test_section_id} $WINDIR
60 \c FunctionEnd
61
62 \S2{sectiongettext} SectionGetText
63
64 \c section_index user_var(output)
65
66 Stores the text description of the section section_index into the output. If the section is hidden, stores an empty string. The error flag will be set if an out of range section is specified.
67
68 \c Section test test_section_id
69 \c SectionEnd
70 \c
71 \c Function .onInit
72 \c # append $WINDIR to section's name
73 \c SectionGetText ${test_section_id} $0
74 \c StrCpy $0 "$0 - $WINDIR"
75 \c SectionSetText ${test_section_id} $0
76 \c FunctionEnd
77
78 \S2{sectionsetinsttypes} SectionSetInstTypes
79
80 \c section_index inst_types
81
82 Sets the install types the section specified by section_index defaults to the enabled state in. Note that the section index starts with zero. Every bit of inst_types is a flag that tells if the section is in that install type or not. For example, if you have 3 install types and you want the first section to be included in install types 1 and 3, then the command should look like this:
83
84 \c SectionSetInstTypes 0 5
85
86 because the binary value for 5 is "...00101". The error flag will be set if the section index specified is out of range.
87
88 \c Section test test_section_id
89 \c SectionEnd
90 \c
91 \c Function .onInit
92 \c # associate section 'test' with installation types 3 and 4
93 \c SectionSetInstTypes ${test_section_id} 12
94 \c FunctionEnd
95
96 \S2{sectiongetinsttypes} SectionGetInstTypes
97
98 \c section_index user_var(output)
99
100 Retrieves the install types flags array of a section. See above explanation about \R{sectionsetinsttypes}{SectionSetInstTypes} for a description of how to deal with the output. The error flag will be set if the section index is out of range.
101
102 \c Section test test_section_id
103 \c SectionEnd
104 \c
105 \c Function .onInit
106 \c # associate section 'test' with installation types 5, on top of its existing associations
107 \c SectionGetInstTypes ${test_section_id} $0
108 \c IntOp $0 $0 | 16
109 \c SectionSetInstTypes ${test_section_id} $0
110 \c FunctionEnd
111
112 \S2{ssectionsetsize} SectionSetSize
113
114 \c section_index new_size
115
116 Sets the size of the section specified by section_index. Note that the index starts with zero. The Value for Size must be entered in KiloByte and supports only whole numbers.
117
118 \c Section test test_section_id
119 \c SectionEnd
120 \c
121 \c Function .onInit
122 \c # set required size of section 'test' to 100 bytes
123 \c SectionSetSize ${test_section_id} 100
124 \c FunctionEnd
125
126 \S2{ssectiongetsize} SectionGetSize
127
128 \c section_index user_var
129
130 Gets the size of the section specified by section_index and stores the value in the given user variable. Note that the index starts with zero. The error flag will be set if the section index is out of range.
131
132 \c Section test test_section_id
133 \c SectionEnd
134 \c
135 \c Function .onInit
136 \c # increase required size of section 'test' by 100 KiB
137 \c SectionGetSize ${test_section_id} $0
138 \c IntOp $0 $0 + 100
139 \c SectionSetSize ${test_section_id} $0
140 \c FunctionEnd
141
142 \S2{ssetcurinsttype} SetCurInstType
143
144 \c inst_type_idx
145
146 Sets the current \R{ainsttype}{InstType}. inst_type_idx should be between 0 and 31. The error flag is \s{not} set if an out of range \R{ainsttype}{InstType} was used.
147
148 \S2{sgetcurinsttype} GetCurInstType
149
150 \c user_var
151
152 Get the current \R{ainsttype}{InstType} and stores it in user_var. If the first install type is selected, 0 will be put in user_var. If the second install type is selected, 1 will be put in user_var, and so on. The value of $\{NSIS_MAX_INST_TYPES\} (32 by default) means that the user selected a custom set of sections (Simply selecting "Custom" in the drop-down menu is not enough to trigger this, the value is calculated by the sections actually selected).
153
154 \S2{sinsttypesettext} InstTypeSetText
155
156 \c inst_type_idx text
157
158 Sets the text of the specified \R{ainsttype}{InstType}. If the text is empty then the \R{ainsttype}{InstType} is removed. By using a previously unused inst_type_idx number you can create new InstTypes. To add/remove Sections to this new \R{ainsttype}{InstType} see \R{sectionsetinsttypes}{SectionSetInstTypes}. Unlike \R{ssectionin}{SectionIn} the index is zero based, which means the first install type's index is 0.
159
160 \c InstType a
161 \c InstType b
162 \c
163 \c Function .onInit
164 \c # set first installation type's name to $WINDIR
165 \c InstTypeSetText 0 $WINDIR
166 \c # set second installation type's name to $TEMP
167 \c InstTypeSetText 1 $TEMP
168 \c FunctionEnd
169
170 \S2{sinsttypegettext} InstTypeGetText
171
172 \c inst_type_idx user_var
173
174 Gets the text of the specified \R{ainsttype}{InstType}.
175
176 \c InstType a
177 \c InstType b
178 \c
179 \c Function .onInit
180 \c InstTypeGetText 0 $0
181 \c DetailPrint $0 # prints 'a'
182 \c InstTypeGetText 1 $0
183 \c DetailPrint $0 # prints 'b'
184 \c FunctionEnd