Debian Codegraph @

Contrib/InstallOptions/Readme.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>InstallOptions 2</title>
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7 <meta name="viewport" content="width=device-width, initial-scale=1" />
8 <style type="text/css">
9 /*<![CDATA[*/
10 html, body { font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; background-color: #ffffff; }
11 html { font-size: 0.80em; }
12 body { font-size: 1em; font-size: 1rem; }
13 pre, code { font-family: Courier New, Courier, monospace,serif; font-size: 100%; }
14 body
15 {
16 padding:1.5em 0; margin:0;
17 background-color: #F0F0F0;
18 font-family: Verdana, Arial, Helvetica, sans-serif;
19 font-weight: normal;
20 text-align: left;
21 }
22 p, li
23 {
24 font-size: 100%;
25 }
26 .center
27 {
28 text-align: center;
29 }
30 table
31 {
32 margin: auto;
33 font-size: 100%;
34 background-color: #FFFFFF;
35 }
36 .maintable
37 {
38 border: 2px solid #376EAB;
39 width: 90%;
40 }
41 .parameter
42 {
43 font-weight: bold;
44 color: #6586AC;
45 }
46 h1
47 {
48 font-size: 140%;
49 color: #333333;
50 font-weight: normal;
51 text-align: center;
52 margin-top: 1.5em;
53 }
54 h2
55 {
56 font-size: 130%;
57 color: #7A7272;
58 font-weight: normal;
59 }
60 h3
61 {
62 font-size: 120%;
63 font-weight: bold;
64 color: #303030;
65 }
66 div
67 {
68 margin: 1.1em;
69 }
70 a:link, a:visited, a:active
71 {
72 color: #294F75;
73 text-decoration: none;
74 }
75 a:hover
76 {
77 color: #182634;
78 text-decoration: underline;
79 }
80 .subtable
81 {
82 border: 0px;
83 margin-left: 1.3em;
84 margin-right: 1.3em;
85 }
86 .lefttable
87 {
88 background-color: #CCCCCC;
89 vertical-align: top;
90 }
91 .righttable
92 {
93 background-color: #EEEEEE;
94 vertical-align: top;
95 }
96 /*]]>*/</style>
97 </head>
98 <body>
99 <table width="750" class="maintable" cellspacing="0" cellpadding="0" align="center">
100 <tr>
101 <td>
102 <h1>
103 InstallOptions 2</h1>
104 <div>
105 <p>
106 The InstallOptions plug-in is deprecated. For new scripts, it is recommended to
107 use the new nsDialogs plug-in instead.</p>
108 </div>
109 <div>
110 <h2 id="intro">
111 Introduction</h2>
112 <div>
113 <p>
114 InstallOptions is an NSIS plugin which allows you to create custom pages for NSIS
115 installers, to prompt the user for extra information.</p>
116 <p>
117 The dialogs created by InstallOptions are based on INI files which define the controls
118 on the dialog and their properties. These INI files can be modified from the script
119 to adjust the dialogs at runtime.</p>
120 <p>
121 The format of INI files is described in a <a href="http://en.wikipedia.org/wiki/Ini_file">
122 Wikipedia article</a>.</p>
123 </div>
124 <h2 id="ini">
125 INI file structure</h2>
126 <div>
127 <p>
128 The INI file has one required section. This section includes the number of controls
129 to be created as well as general window attributes. The INI file also includes a
130 variable number of Field sections which are used to create the controls to be displayed.</p>
131 <p>
132 The required section is named &quot;<em>Settings</em>&quot;. It can contain the
133 following values:</p>
134 <table class="subtable">
135 <tr>
136 <td class="lefttable">
137 <strong>NumFields</strong></td>
138 <td class="lefttable">
139 <em>(required)</em></td>
140 <td class="righttable">
141 The number of control elements to be displayed on the dialog window.</td>
142 </tr>
143 <tr>
144 <td class="lefttable">
145 <strong>Title</strong></td>
146 <td class="lefttable">
147 <em>(optional)</em></td>
148 <td class="righttable">
149 If specified, gives the text to set the titlebar to. Otherwise, the titlebar text
150 is not changed.</td>
151 </tr>
152 <tr>
153 <td class="lefttable">
154 <strong>CancelEnabled</strong></td>
155 <td class="lefttable">
156 <em>(optional)</em></td>
157 <td class="righttable">
158 If specified, overrides NSIS settings and enables or disables the cancel button.
159 If set to 1, the cancel button will be enabled. If set to 0, the cancel button will
160 be disabled.</td>
161 </tr>
162 <tr>
163 <td class="lefttable">
164 <strong>CancelShow</strong></td>
165 <td class="lefttable">
166 <em>(optional)</em></td>
167 <td class="righttable">
168 If specified, overrides NSIS settings and shows or hides the cancel button If set
169 to 1, the cancel button will be shown. If set to 0, the cancel button will be hidden.</td>
170 </tr>
171 <tr>
172 <td class="lefttable">
173 <strong>BackEnabled</strong></td>
174 <td class="lefttable">
175 <em>(optional)</em></td>
176 <td class="righttable">
177 If specified, overrides NSIS settings and enables or disables the back button. If
178 set to 1, the back button will be enabled. If set to 0, the back button will be
179 disabled.</td>
180 </tr>
181 <tr>
182 <td class="lefttable">
183 <strong>CancelButtonText</strong></td>
184 <td class="lefttable">
185 <em>(optional)</em></td>
186 <td class="righttable">
187 Overrides the text for the cancel button. If not specified, the cancel button text
188 will not be changed.</td>
189 </tr>
190 <tr>
191 <td class="lefttable">
192 <strong>NextButtonText</strong></td>
193 <td class="lefttable">
194 <em>(optional)</em></td>
195 <td class="righttable">
196 Overrides the text for the next button. If not specified, the next button text will
197 not be changed.</td>
198 </tr>
199 <tr>
200 <td class="lefttable">
201 <strong>BackButtonText</strong></td>
202 <td class="lefttable">
203 <em>(optional)</em></td>
204 <td class="righttable">
205 Overrides the text for the back button. If not specified, the back button text will
206 not be changed.</td>
207 </tr>
208 <tr>
209 <td class="lefttable">
210 <strong>Rect</strong></td>
211 <td class="lefttable">
212 <em>(optional)</em></td>
213 <td class="righttable">
214 Overrides the default rect ID to run over. This will make IO resize itself according
215 to a different rect than NSIS's dialogs rect.</td>
216 </tr>
217 <tr>
218 <td class="lefttable">
219 <strong>RTL</strong></td>
220 <td class="lefttable">
221 <em>(optional)</em></td>
222 <td class="righttable">
223 If 1 is specified the dialog will be mirrored and all texts will be aligned to the
224 right. The INSTALLOPTIONS_EXTRACT macros automatically set this field to the right
225 value for the current installer language as given by the NSIS string $(^RTL).</td>
226 </tr>
227 <tr>
228 <td class="lefttable">
229 <strong>State</strong></td>
230 <td class="lefttable">
231 <em>(output)</em></td>
232 <td class="righttable">
233 This is not something you have to supply yourself but is set by InstallOptions,
234 before calling your custom page validation function, to the field number of the
235 custom Button control (or other control having the Notify flag) the user pressed,
236 if any.</td>
237 </tr>
238 </table>
239 <p>
240 Each field section has the heading &quot;Field #&quot; where # must be sequential
241 numbers from 1 to NumFields. Each Field section can contain the following values:</p>
242 <table class="subtable">
243 <tr>
244 <td class="lefttable">
245 <strong>Type</strong></td>
246 <td class="lefttable">
247 <em>(required)</em></td>
248 <td class="righttable">
249 Type of control to be created. Valid values are &quot;<em>Label</em>&quot;, &quot;<em>Text</em>&quot;,
250 &quot;<em>Password</em>&quot;, &quot;<em>Combobox</em>&quot;, &quot;<em>DropList</em>&quot;,
251 &quot;<em>Listbox</em>&quot;, &quot;<em>CheckBox</em>&quot;, &quot;<em>RadioButton</em>&quot;,
252 &quot;<em>FileRequest</em>&quot;, &quot;<em>DirRequest</em>&quot; &quot;<em>Icon</em>&quot;,
253 &quot;<em>Bitmap</em>&quot;, &quot;<em>GroupBox</em>&quot;, &quot;<em>HLine</em>&quot;,
254 &quot;<em>VLine</em>&quot;, &quot;<em>Link</em>&quot; or &quot;<em>Button</em>&quot;.<br />
255 <br />
256 A &quot;<em>Label</em>&quot; is used to display static text. (i.e. a caption for
257 a textbox)<br />
258 A &quot;<em>Text</em>&quot; and &quot;<em>Password</em>&quot; accept text input
259 from the user. &quot;<em>Password</em>&quot; masks the input with * characters.<br />
260 A &quot;<em>Combobox</em>&quot; allows the user to type text not in the popup list,
261 a &quot;<em>Droplist</em>&quot; only allows selection of items in the list.<br />
262 A &quot;<em>Listbox</em>&quot; shows multiple items and can optionally allow the
263 user to select more than one item.<br />
264 A &quot;<em>CheckBox</em>&quot; control displays a check box with label.<br />
265 A &quot;<em>RadioButton</em>&quot; control displays a radio button with label.<br />
266 A &quot;<em>FileRequest</em>&quot; control displays a textbox and a browse button.
267 Clicking the browse button will display a file requester where the user can browse
268 for a file.<br />
269 A &quot;<em>DirRequest</em>&quot; control displays a textbox and a browse button.
270 Clicking the browse button will display a directory requester where the user can
271 browse for a directory.<br />
272 An &quot;<em>Icon</em>&quot; control displays an icon. Use no Text to use the installer
273 icon.<br />
274 A &quot;<em>Bitmap</em>&quot; control displays a bitmap.<br />
275 A &quot;<em>GroupBox</em>&quot; control displays a frame to group controls.<br />
276 A &quot;<em>HLine</em>&quot; control displays a horizontal line to separate controls.<br />
277 A &quot;<em>VLine</em>&quot; control displays a vertical line to separate controls.<br />
278 A &quot;<em>Link</em>&quot; control displays a static hot text. When the user clicks
279 the control the contents of <strong>State</strong> (e.g. http://...) will be executed
280 using ShellExecute. Alternatively <strong>State</strong> can be omitted and the
281 <em>NOTIFY</em> flag used to have your NSIS script called. See the &quot;<em>NOTIFY</em>&quot;
282 flag below for more information.<br />
283 A &quot;<em>Button</em>&quot; control displays a push button that can be used in
284 the same way as the &quot;<em>Link</em>&quot; control above.</td>
285 </tr>
286 <tr>
287 <td class="lefttable">
288 <strong>Text</strong></td>
289 <td class="lefttable">
290 <em>(optional)</em></td>
291 <td class="righttable">
292 Specifies the caption of a label, checkbox, or radio button control. For DirRequest
293 control this specifies the title of the browse dialog. For icon and bitmaps control
294 this specifies the path to the image.<br />
295 <br />
296 <strong>Note:</strong> For labels, \r\n will be converted to a newline. To use a
297 back-slash in your text you have to escape it using another back-slash - \\. Described
298 <a href="#escaping">below</a> are NSIS functions for converting text to/from this
299 format.</td>
300 </tr>
301 <tr>
302 <td class="lefttable">
303 <strong>State</strong></td>
304 <td class="lefttable">
305 <em>(optional)</em></td>
306 <td class="righttable">
307 Specifies the state of the control. This is updated when the user closes the window,
308 so you can read from it from NSIS. For edit texts and dir and file request boxes,
309 this is the string that is specified. For radio button and check boxes, this can
310 be '0' or '1' (for unchecked or checked). For list boxes, combo boxes and drop lists
311 this is the selected items separated by pipes ('|'). For Links and Buttons this
312 can specify something to be executed or opened (using ShellExecute).<br />
313 <br />
314 <strong>Note:</strong> For Text fields with the MULTILINE flag, \r\n will be converted
315 to a newline. To use a back-slash in your text you have to escape it using another
316 back-slash - \\. Described <a href="#escaping">below</a> are NSIS functions for
317 converting text to/from this format.</td>
318 </tr>
319 <tr>
320 <td class="lefttable">
321 <strong>ListItems</strong></td>
322 <td class="lefttable">
323 <em>(optional)</em></td>
324 <td class="righttable">
325 A list of items to display in a combobox, droplist, or listbox.<br />
326 This is a single line of text with each item separated by a pipe character '|'</td>
327 </tr>
328 <tr>
329 <td class="lefttable">
330 <strong>MaxLen</strong></td>
331 <td class="lefttable">
332 <em>(optional)</em></td>
333 <td class="righttable">
334 Causes validation on the selected control to limit the maximum length of text.<br />
335 If the user specifies more text than this, a message box will appear when they click
336 &quot;OK&quot; and the dialog will not be dismissed.<br />
337 You should not use this on a &quot;<em>combobox</em>&quot; since the user can not
338 control what is selected.<br />
339 This should be set to a maximum of 260 for &quot;<em>FileRequest</em>&quot; and
340 &quot;<em>DirRequest</em>&quot; controls.<br />
341 Ignored on &quot;<em>Label</em>&quot; controls.</td>
342 </tr>
343 <tr>
344 <td class="lefttable">
345 <strong>MinLen</strong></td>
346 <td class="lefttable">
347 <em>(optional)</em></td>
348 <td class="righttable">
349 Causes validation on the selected control to force the user to enter a minimum amount
350 of text.<br />
351 If the user specifies less text than this, a message box will appear when they click
352 &quot;OK&quot; and the dialog will not be dismissed.<br />
353 Unlike MaxLen, this is useful for &quot;<em>Combobox</em>&quot; controls. By setting
354 this to a value of &quot;1&quot; the program will force the user to select an item.<br />
355 Ignored on &quot;<em>Label</em>&quot; controls.</td>
356 </tr>
357 <tr>
358 <td class="lefttable">
359 <strong>ValidateText</strong></td>
360 <td class="lefttable">
361 <em>(optional)</em></td>
362 <td class="righttable">
363 If the field fails the test for &quot;<em>MinLen</em>&quot; or &quot;<em>MaxLen</em>&quot;,
364 a messagebox will be displayed with this text.<br />
365 <br />
366 <strong>Note:</strong> \r\n will be converted to a newline, two back-slashes will
367 be converted to one - \\. Described <a href="#escaping">below</a> are NSIS functions
368 for converting text to/from this format.</td>
369 </tr>
370 <tr>
371 <td class="lefttable">
372 <strong>Left<br />
373 Right<br />
374 Top<br />
375 Bottom</strong></td>
376 <td class="lefttable">
377 <em>(required)</em></td>
378 <td class="righttable">
379 The position on the dialog where this control appears. All sizes should be set in
380 dialog units. To get the right dimensions for your controls, design your dialog
381 using a resource editor and copy the dimensions to the INI file.<br />
382 <br />
383 <strong>Note:</strong> You can specify negative coordinates to specify the distance
384 from the right or bottom edge.<br />
385 <br />
386 <strong>Note (2):</strong> For combobox or droplist, the &quot;<em>bottom</em>&quot;
387 value is not used in the same way.<br />
388 In this case, the bottom value is the maximum size of the window when the pop-up
389 list is being displayed. All other times, the combobox is automatically sized to
390 be one element tall. If you have trouble where you can not see the combobox drop-down,
391 then check the bottom value and ensure it is large enough. A rough guide for the
392 height required is the number of items in the list multiplied by 8, plus 20.<br />
393 <br />
394 <strong>Note (3):</strong> FileRequest and DirRequest controls will allocate 15
395 dialog units to the browse button. Make this control wide enough the contents of
396 the textbox can be seen.</td>
397 </tr>
398 <tr>
399 <td class="lefttable">
400 <strong>Filter</strong></td>
401 <td class="lefttable">
402 <em>(optional)</em></td>
403 <td class="righttable">
404 Specifies the filter to be used in the &quot;<em>FileRequest</em>&quot; control.<br />
405 This is constructed by putting pairs of entries together, each item separated by
406 a | character.<br />
407 The first value in each pair is the text to display for the filter.<br />
408 The second value is the pattern to use to match files.<br />
409 For example, you might specify:<br />
410 Filter=Text Files|*.txt|Programs|*.exe;*.com|All Files|*.*<br />
411 If not specified, then the filter defaults to All Files|*.*<br />
412 <br />
413 <strong>Note:</strong> you should not put any extra spaces around the | characters.</td>
414 </tr>
415 <tr>
416 <td class="lefttable">
417 <strong>Root</strong></td>
418 <td class="lefttable">
419 <em>(optional)</em></td>
420 <td class="righttable">
421 Used by <strong>DirRequest</strong> controls to specify the root directory of the
422 search. By default, this allows the user to browse any directory on the computer.
423 This will limit the search to a particular directory on the system.</td>
424 </tr>
425 <tr>
426 <td class="lefttable">
427 <strong>Flags</strong></td>
428 <td class="lefttable">
429 <em>(optional)</em></td>
430 <td class="righttable">
431 This specifies additional flags for the display of different controls. Each value
432 should be separated by a | character, and you should be careful not to put any spaces
433 around the | character.<br />
434 <table class="righttable">
435 <tr>
436 <td class="righttable">
437 <strong>Value</strong></td>
438 <td class="righttable">
439 <strong>Meaning</strong></td>
440 </tr>
441 <tr>
442 <td class="righttable">
443 REQ_SAVE</td>
444 <td class="righttable">
445 This causes &quot;<em>FileRequest</em>&quot; controls to display a Save As dialog.
446 If not specified, an Open dialog is used.</td>
447 </tr>
448 <tr>
449 <td class="righttable">
450 FILE_MUST_EXIST</td>
451 <td class="righttable">
452 Used by &quot;<em>FileRequest</em>&quot; to determine if the selected file must
453 exist.<br />
454 This only applies if an &quot;Open&quot; dialog is being displayed.<br />
455 This currently does not force the file to exist other than through the browse button.</td>
456 </tr>
457 <tr>
458 <td class="righttable">
459 FILE_EXPLORER</td>
460 <td class="righttable">
461 Used by &quot;<em>FileRequest</em>&quot;, enables new file request look (recommended)</td>
462 </tr>
463 <tr>
464 <td class="righttable">
465 FILE_HIDEREADONLY</td>
466 <td class="righttable">
467 Used by &quot;<em>FileRequest</em>&quot;, hides &quot;open read only&quot; checkbox
468 in open dialog.</td>
469 </tr>
470 <tr>
471 <td class="righttable">
472 WARN_IF_EXIST</td>
473 <td class="righttable">
474 Used by &quot;<em>FileRequest</em>&quot; to display a warning message if the selected
475 file already exists.<br />
476 The warning message is only displayed for files selected with the browse button.</td>
477 </tr>
478 <tr>
479 <td class="righttable">
480 PATH_MUST_EXIST</td>
481 <td class="righttable">
482 Used by &quot;<em>FileRequest</em>&quot; to force the path to exist. Prevents the
483 user from typing a non-existent path into the browse dialog window.<br />
484 This only validates path's selected with the browse button.</td>
485 </tr>
486 <tr>
487 <td class="righttable">
488 PROMPT_CREATE</td>
489 <td class="righttable">
490 Used by &quot;<em>FileRequest</em>&quot; to display a warning if the selected file
491 does not exist. However, it still allows the user to select the file.<br />
492 This only displays the warning for files selected with the browse button.<br />
493 Doesn't work along with REQ_SAVE.</td>
494 </tr>
495 <tr>
496 <td class="righttable">
497 RIGHT</td>
498 <td class="righttable">
499 Used by &quot;<em>Checkbox</em>&quot; and &quot;<em>Radiobutton</em>&quot; controls
500 to specify you want the checkbox to the right of the text instead of the left as
501 is the default.</td>
502 </tr>
503 <tr>
504 <td class="righttable">
505 MULTISELECT</td>
506 <td class="righttable">
507 Used by &quot;<em>Listbox</em>&quot; controls. Turns string selection on or off
508 each time the user clicks or double-clicks a string in the list box. The user can
509 select any number of strings. If this flag and EXTENDEDSELCT are not specified,
510 only one item can be selected from the list.</td>
511 </tr>
512 <tr>
513 <td class="righttable">
514 EXTENDEDSELCT</td>
515 <td class="righttable">
516 Used by &quot;<em>Listbox</em>&quot; controls. Allows multiple items to be selected
517 by using the SHIFT key and the mouse or special key combinations. If this flag and
518 MULTISELECT are not specified, only one item can be selected from the list.</td>
519 </tr>
520 <tr>
521 <td class="righttable">
522 RESIZETOFIT</td>
523 <td class="righttable">
524 This causes &quot;<em>Bitmap</em>&quot; controls to resize the image to the size
525 of the control. Also useful to support custom DPI settings. Without this, the image
526 will be centered within the specified area.</td>
527 </tr>
528 <td class="righttable">
529 TRANSPARENT</td>
530 <td class="righttable">
531 Used by &quot;<em>Bitmap</em>&quot; controls. Hides every pixel with the same color
532 as of the top left pixel. This allows to see-through to controls behind it. This
533 flag doesn't work well with a combination of the RESIZETOFIT flag and bitmaps with
534 more than 256 colors.</td>
535 </tr>
536 <tr>
537 <td class="righttable">
538 GROUP</td>
539 <td class="righttable">
540 Add this flag to the first control of a group of controls to group them. Grouping
541 controls allows you to create multiple groups of radio button and makes keyboard
542 navigation using arrow keys easier.</td>
543 </tr>
544 <tr>
545 <td class="righttable">
546 FOCUS</td>
547 <td class="righttable">
548 Sets focus on the specified control, instead of the first focusable control. If
549 more than one field is specified with this flag, only the first one will receive
550 focus.</td>
551 </tr>
552 <tr>
553 <td class="righttable">
554 NOTABSTOP</td>
555 <td class="righttable">
556 Do not stop on the control when the user pressed the Tab key. Add NOTABSTOP to all
557 controls of a group except the first one to allow navigation between groups with
558 the Tab key.</td>
559 </tr>
560 <tr>
561 <td class="righttable">
562 DISABLED</td>
563 <td class="righttable">
564 Causes a control to be disabled.</td>
565 </tr>
566 <tr>
567 <td class="righttable">
568 ONLY_NUMBERS</td>
569 <td class="righttable">
570 Used by &quot;<em>Text</em>&quot; controls. Forces the user to enter only numbers
571 into the edit box.</td>
572 </tr>
573 <tr>
574 <td class="righttable">
575 MULTILINE</td>
576 <td class="righttable">
577 Used by &quot;<em>Text</em>&quot; controls. Causes the control to accept multiple-lines.</td>
578 </tr>
579 <tr>
580 <td class="righttable">
581 WANTRETURN</td>
582 <td class="righttable">
583 Used by &quot;<em>Text</em>&quot; controls with multiple-line. Specifies that a
584 carriage return be inserted when the user presses the ENTER key while entering text
585 into the text box.</td>
586 </tr>
587 <tr>
588 <td class="righttable">
589 NOWORDWRAP</td>
590 <td class="righttable">
591 Used by &quot;<em>Text</em>&quot; controls with multiple-line. Disables the word-wrap
592 that occurs when long lines are entered. Long lines instead scroll off to the side.
593 Specifying the HSCROLL flag also has this effect.</td>
594 </tr>
595 <tr>
596 <td class="righttable">
597 HSCROLL</td>
598 <td class="righttable">
599 Show a horizontal scrollbar. When used by &quot;<em>Text</em>&quot; controls with
600 multiple-lines this also disables word-wrap.</td>
601 </tr>
602 <tr>
603 <td class="righttable">
604 VSCROLL</td>
605 <td class="righttable">
606 Show a vertical scrollbar.</td>
607 </tr>
608 <tr>
609 <td class="righttable">
610 READONLY</td>
611 <td class="righttable">
612 Used by &quot;<em>Text</em>&quot; controls. Prevents the user from entering or editing
613 text in the edit control, but allow the user to select and copy the text.</td>
614 </tr>
615 <tr>
616 <td class="righttable">
617 NOTIFY</td>
618 <td class="righttable">
619 Used by &quot;<em>Button</em>&quot;, &quot;<em>Link</em>&quot;, &quot;<em>CheckBox</em>&quot;,
620 &quot;<em>RadioButton</em>&quot;, &quot;<em>ListBox</em>&quot; and &quot;<em>DropList</em>&quot;
621 controls. Causes InstallOptions to call your NSIS custom page validation/leave function
622 whenever the control's selection changes. Your validation/leave function can read
623 the &quot;<em>State</em>&quot; value from the &quot;<em>Settings</em>&quot; section
624 to determine which control caused the notification, if any, and perform some appropriate
625 action followed by an Abort instruction (to tell NSIS to return to the page). The
626 Examples\InstallOptions folder contains an example script showing how this might
627 be used.</td>
628 </tr>
629 </table>
630 </td>
631 </tr>
632 <tr>
633 <td class="lefttable">
634 <strong>TxtColor</strong></td>
635 <td class="lefttable">
636 <em>(optional)</em></td>
637 <td class="righttable">
638 Used by <strong>Link</strong> controls to specify the foreground color of the text.
639 Format: 0xBBGGRR (hexadecimal).</td>
640 </tr>
641 <tr>
642 <td class="lefttable">
643 <strong>HWND<br>
644 HWND2</strong></td>
645 <td class="lefttable">
646 <em>(output)</em></td>
647 <td class="righttable">
648 After initDialog returns, this will contain the HWND of the control created by this
649 field. It can be used instead of FindWindow and GetDlgItem. HWND2 contains the HWND
650 of an additional control, such as the browse button.</td>
651 </tr>
652 </table>
653 </div>
654 <h2 id="nsh">
655 Header file</h2>
656 <div>
657 <p>
658 The InstallOptions header files provides macros and functions to easily create custom
659 dialogs. You can include it on the top of your script as follows:
660 <pre>
661 !include InstallOptions.nsh
662 </pre>
663 </div>
664 <h2 id="dialog">
665 Creating dialogs</h2>
666 <div>
667 <h3 id="extract">
668 Extracting the INI file</h3>
669 <div>
670 <p>
671 First, you have to extract your InstallOptions INI files in the .onInit function
672 (or un.onInit for the uninstaller) using the INSTALLOPTIONS_EXTRACT macro. The files
673 will be extracted to a temporary folder (the NSIS plug-ins folder) that is automatically
674 created.</p>
675 <pre>
676 Function .onInit
677 !insertmacro INSTALLOPTIONS_EXTRACT &quot;ioFile.ini&quot;
678 FunctionEnd
679 </pre>
680 <p>
681 If the INI file is located in another directory, use INSTALLOPTIONS_EXTRACT_AS.
682 The second parameter is the filename in the temporary folder, which is the filename
683 that should be used as input for the other macros.</p>
684 <pre>
685 Function .onInit
686 !insertmacro INSTALLOPTIONS_EXTRACT_AS &quot;..\ioFile.ini&quot; &quot;ioFile.ini&quot;
687 FunctionEnd
688 </pre>
689 </div>
690 <h3 id="display">
691 Displaying the dialog</h3>
692 <div>
693 <p>
694 You can call InstallOptions in a page function defined with the Page or UninstPage
695 command. Check the NSIS documentation (Scripting Reference -&gt; Pages) for information
696 about the page system.</p>
697 <pre>
698 Page custom CustomPageFunction</pre>
699 <p>
700 To display the dialog, use the INSTALLOPTIONS_DISPLAY macro:<pre>
701 Function CustomPageFunction ;Function name defined with Page command
702 !insertmacro INSTALLOPTIONS_DISPLAY &quot;ioFile.ini&quot;
703 FunctionEnd
704 </pre>
705 </div>
706 </div>
707 <h2 id="input">
708 User input</h2>
709 <div>
710 <p>
711 To get the input of the user, read the State value of a Field using the INSTALLOPTIONS_READ
712 macro:</p>
713 <pre>
714 !insertmacro INSTALLOPTIONS_READ $VAR &quot;ioFile.ini&quot; &quot;Field #&quot; &quot;Name&quot;
715 </pre>
716 </div>
717 <h2 id="writing">
718 Writing to INI files</h2>
719 <div>
720 <p>
721 The INSTALLOPTIONS_WRITE macro allows you to write values to the INI file to change
722 texts or control settings at runtime:
723 <pre>
724 !insertmacro INSTALLOPTIONS_WRITE &quot;ioFile.ini&quot; &quot;Field #&quot; &quot;Name&quot; &quot;Value&quot;
725 </pre>
726 </div>
727 <h2 id="escape">
728 Escaped values</h2>
729 <div>
730 <p>
731 Some InstallOptions values are escaped (in a similar manner to &quot;C&quot; strings)
732 to allow characters to be used that are not normally valid in INI file values. The
733 affected values are:</p>
734 <ul>
735 <li>The ValidateText field</li>
736 <li>The Text value of Label fields</li>
737 <li>The State value of Text fields that have the MULTILINE flag</li>
738 </ul>
739 <p>
740 The escape character is the back-slash character (&quot;\&quot;) and the available
741 escape sequences are:</p>
742 <table class="subtable">
743 <tr>
744 <td class="lefttable">
745 &quot;\\&quot;</td>
746 <td class="righttable">
747 Back-slash</td>
748 </tr>
749 <tr>
750 <td class="lefttable">
751 &quot;\r&quot;</td>
752 <td class="righttable">
753 Carriage return (ASCII 13)</td>
754 </tr>
755 <tr>
756 <td class="lefttable">
757 &quot;\n&quot;</td>
758 <td class="righttable">
759 Line feed (ASCII 10)</td>
760 </tr>
761 <tr>
762 <td class="lefttable">
763 &quot;\t&quot;</td>
764 <td class="righttable">
765 Tab (ASCII 9)</td>
766 </tr>
767 </table>
768 <p>
769 The INSTALLOPTIONS_READ_CONVERT and INSTALLOPTIONS_WRITE_CONVERT macros automatically
770 convert these characters in installer code. In uninstaller code, use INSTALLOPTIONS_READ_UNCONVERT
771 and INSTALLOPTIONS_WRITE_UNCONVERT.</p>
772 <p>
773 To use these macros in your script, the conversion functions need to be included:</p>
774 <pre>
775 ;For INSTALLOPTIONS_READ_CONVERT
776 !insertmacro INSTALLOPTIONS_FUNCTION_READ_CONVERT
777 ;For INSTALLOPTIONS_WRITE_CONVERT
778 !insertmacro INSTALLOPTIONS_FUNCTION_WRITE_CONVERT
779 ;For INSTALLOPTIONS_READ_UNCONVERT
780 !insertmacro INSTALLOPTIONS_UNFUNCTION_READ_CONVERT
781 ;For INSTALLOPTIONS_WRITE_UNCONVERT
782 !insertmacro INSTALLOPTIONS_UNFUNCTION_WRITE_CONVERT
783 </pre>
784 </div>
785 <h2 id="validate">
786 Input validation</h2>
787 <div>
788 <p>
789 To validate the user input (for example, to check whether the user has filled in
790 a textbox) use the leave function of the Page command and Abort when the validation
791 has failed:</p>
792 <pre>
793 Function ValidateCustom
794
795 !insertmacro INSTALLOPTIONS_READ $R0 "test.ini" "Field 1" "State"
796 StrCmp $R0 "" 0 +3
797 MessageBox MB_ICONEXCLAMATION|MB_OK "Please enter your name."
798 Abort
799
800 FunctionEnd
801 </pre>
802 </div>
803 <h2 id="dialogreturn">
804 Return value</h2>
805 <div>
806 After a dialog is created (using display or show), a return value is available:</p>
807 <ul>
808 <li>success - The user has pressed the Next button</li>
809 <li>back - The user has pressed the Back button</li>
810 <li>cancel - The user has pressed the Cancel button</li>
811 <li>error - An error has occurred, the dialog cannot be displayed.</li>
812 </ul>
813 <p>
814 You only have to check this value if you need something really special, such as
815 doing something when the user pressed the Back button.</p>
816 <p>
817 If you need the return value, use the INSTALLOPTIONS_DISPLAY_RETURN or INSTALLOPTIONS_SHOW_RETURN
818 macro. The return value will be added to the stack, so you can use the Pop command
819 to get it.</p>
820 </div>
821 <h2 id="reserve">
822 Reserve files</h2>
823 <div>
824 <p>
825 When using solid compression, it's important that files which are being extracted
826 in user interface functions are located before other files in the data block. Otherwise
827 there may be a delay before a page can be displayed.</p>
828 <p>
829 To ensure that this is the case, add ReserveFile commands for InstallOptions and
830 the INI files before all sections and functions:</p>
831 <pre>
832 ReserveFile &quot;test.ini&quot;
833 ReserveFile /plugin InstallOptions.dll
834 </pre>
835 </div>
836 <h2>
837 Fonts and colors</h2>
838 <div>
839 <p>
840 To customize fonts or colors on InstallOptions dialogs, the INSTALLOPTIONS_INITDIALOG
841 and INSTALLOPTIONS_SHOW macro can be used.</p>
842 <p>
843 INSTALLOPTIONS_INITDIALOG creates the dialog in memory, but does not show it. After
844 inserting this macro, you can set the fonts and colors, and then insert INSTALLOPTIONS_SHOW
845 to show the dialog.</p>
846 <p>
847 The INSTALLOPTIONS_INITDIALOG macro also pushes the HWND of the custom dialog to
848 the stack. Control HWND's are available for each control in the HWND entry of the
849 corresponding field in the INI file.</p>
850 <p>
851 Example of using a custom font:</p>
852 <pre>
853 Var HWND
854 Var DLGITEM
855 Var FONT
856
857 Function FunctionName ;FunctionName defined with Page command
858
859 !insertmacro INSTALLOPTIONS_INITDIALOG &quot;ioFile.ini&quot;
860 Pop $HWND ;HWND of dialog
861
862 !insertmacro INSTALLOPTIONS_READ $DLGITEM &quot;ioFile.ini&quot; &quot;Field 1&quot; &quot;HWND&quot;
863
864 ;$DLGITEM contains the HWND of the first field
865 CreateFont $FONT &quot;Tahoma&quot; 10 700
866 SendMessage $DLGITEM ${WM_SETFONT} $FONT 0
867
868 !insertmacro INSTALLOPTIONS_SHOW
869
870 FunctionEnd
871 </pre>
872 </div>
873 <h2 id="credits">
874 Credits</h2>
875 <div>
876 <p>
877 Original version by Michael Bishop<br />
878 DLL version by Nullsoft, Inc.<br />
879 DLL version 2 by Amir Szekely, ORTIM, Joost Verburg<br />
880 New documentation by Joost Verburg</p>
881 </div>
882 <h2 id="license">
883 License</h2>
884 <div>
885 <pre>
886 Original version Copyright &copy; 2001 Michael Bishop
887 DLL version 1 Copyright &copy; 2001-2002 Nullsoft, Inc., ORTIM
888 DLL version 2 Copyright &copy; 2003-2026 Amir Szekely, Joost Verburg, Dave Laundon
889
890 This software is provided 'as-is', without any express or implied
891 warranty. In no event will the authors be held liable for any damages
892 arising from the use of this software.
893
894 Permission is granted to anyone to use this software for any purpose,
895 including commercial applications, and to alter it and redistribute
896 it freely, subject to the following restrictions:
897
898 1. The origin of this software must not be misrepresented;
899 you must not claim that you wrote the original software.
900 If you use this software in a product, an acknowledgment in the
901 product documentation would be appreciated but is not required.
902 2. Altered versions must be plainly marked as such,
903 and must not be misrepresented as being the original software.
904 3. This notice may not be removed or altered from any distribution.
905 </pre>
906 </div>
907 </div> </td> </tr> </table>
908 </body>
909 </html>