- Added new control type "Button"

- Added new flag "NOTIFY"
- Added new flag "NOWORDWRAP" for multi-line text boxes
- Reduced size down to 12K


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3254 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
eccles 2003-12-04 22:12:25 +00:00
parent c0e8dc4f73
commit 6b73b0e490
7 changed files with 686 additions and 462 deletions

View file

@ -1,3 +1,9 @@
DLL version 2.3 (12/4/2003)
* Added new control type "Button"
* Added new flag "NOTIFY"
* Added new flag "NOWORDWRAP" for multi-line text boxes
* Reduced size down to 12K
DLL version 2.2 (6/10/2003)
* Added New control type LINK
* \r\n converts to newline in Multiline edit box

File diff suppressed because it is too large Load diff

View file

@ -199,6 +199,14 @@ according to a different rect than NSIS's dialogs rect.</td>
<td class="righttable">If 1 is specified the dialog will be mirrored and all texts will be aligned
to the right. Use NSIS's $(^RTL) to fill this field, it's the easiest way.</td>
</tr>
<tr>
<td class="lefttable"><strong>State</strong></td>
<td class="lefttable"><em>(output)</em></td>
<td class="righttable">This is not something you have to supply yourself but is set by
InstallOptions, before calling your custom page validation function, to the field
number of the custom Button control (or other control having the Notify flag) the
user pressed, if any.
</tr>
</table>
<p>Each field section has the heading "Field #" where # must be sequential numbers from 1 to
NumFields. Each Field section can contain the following values:</p>
@ -209,14 +217,14 @@ NumFields. Each Field section can contain the following values:</p>
<td class="righttable">Type of control to be created. Valid values are "<em>Label</em>",
"<em>Text</em>", "<em>Password</em>", "<em>Combobox</em>", "<em>DropList</em>", "<em>Listbox</em>",
"<em>CheckBox</em>", "<em>RadioButton</em>", "<em>FileRequest</em>", "<em>DirRequest</em>"
"<em>Icon</em>", "<em>Bitmap</em>" or "<em>GroupBox</em>".<br />
"<em>Icon</em>", "<em>Bitmap</em>", "<em>GroupBox</em>", "<em>Link</em>" or "<em>Button</em>".<br />
<br />
A "<em>Label</em>" is used to display static text. (i.e. a caption for a textbox)<br />
A "<em>Text</em>" and "<em>Password</em>" accept text input from the user. "<em>Password</em>"
masks the input with * characters.<br />
A "<em>Combobox</em>" allows the user to type text not in the popup list, a "<em>Droplist</em>"
only allows selection of items in the list.<br />
A "<em>listbox</em>" shows multiple items and can optionally allow the user to select more than one
A "<em>Listbox</em>" shows multiple items and can optionally allow the user to select more than one
item.<br />
A "<em>CheckBox</em>" control displays a check box with label.<br />
A "<em>RadioButton</em>" control displays a radio button with label.<br />
@ -228,7 +236,9 @@ An "<em>Icon</em>" control displays an icon. Use no Text to use the installer ic
A "<em>Bitmap</em>" control displays a bitmap.<br />
A "<em>GroupBox</em>" control displays a frame to group controls.<br />
A "<em>Link</em>" control displays a static hot text, when the user click the control the contents
of <strong>State</strong> (e.g. http://...) will be executed using ShellExecute<br /></td>
of <strong>State</strong> (e.g. http://...) will be executed using ShellExecute<br />
A "<em>Button</em>" control displays a push button that your NSIS script can act on
when pressed. See the "<em>NOTIFY</em>" flag for more information.</td>
</tr>
<tr>
<td class="lefttable"><strong>Text</strong></td>
@ -271,7 +281,7 @@ You should not use this on a "<em>combobox</em>" since the user can not control
selected.<br />
This should be set to a maximum of 260 for "<em>FileRequest</em>" and "<em>DirRequest</em>"
controls.<br />
Ignored on "<em>label</em>" controls.</td>
Ignored on "<em>Label</em>" controls.</td>
</tr>
<tr>
<td class="lefttable"><strong>MinLen</strong></td>
@ -444,9 +454,16 @@ carriage return be inserted when the user presses the ENTER key while entering t
box.</td>
</tr>
<tr>
<td class="righttable">NOWORDWRAP</td>
<td class="righttable">Used by "<em>Text</em>" controls with multiple-line. Disables the
word-wrap that occurs when long lines are entered. Long lines instead scroll off to the
side. Specifying the HSCROLL flag also has this effect.
</td>
</tr>
<tr>
<td class="righttable">HSCROLL</td>
<td class="righttable">Used by "<em>Text</em>" controls with multiple-line. Show a horizontal
scrollbar.</td>
scrollbar and disable word-wrap.</td>
</tr>
<tr>
<td class="righttable">VSCROLL</td>
@ -458,6 +475,16 @@ scrollbar.</td>
<td class="righttable">Used by "<em>Text</em>" controls. Prevents the user from entering or editing
text in the edit control, but allow the user to select and copy the text.</td>
</tr>
<tr>
<td class="righttable">NOTIFY</td>
<td class="righttable">Used by "<em>Button</em>", "<em>CheckBox</em>" and "<em>RadioButton</em>"
controls. Causes InstallOptions to call your NSIS custom page validation/leave function
whenever the button is pressed. Your validation/leave function can read the "<em>State</em>"
value from the "<em>Settings</em>" section to determine which custom button has been
pressed, if any, and perform some appropriate action followed by an Abort instruction
(to tell NSIS to return to the page). The Contrib\InstallOptions folder contains an
example script showing how this might be used.</td>
</tr>
</table>
</td>
</tr>
@ -691,6 +718,16 @@ FunctionEnd
</pre>
<h2>Version history</h2>
<ul>
<li>DLL version 2.3 (12/4/2003)
<ul>
<li>Added new control type "Button"</li>
<li>Added new flag "NOTIFY"</li>
<li>Added new flag "NOWORDWRAP" for multi-line text boxes</li>
<li>Reduced size down to 12K</li>
</ul>
</li>
</ul>
<ul>
<li>DLL version 2.2 (4/9/2003)
<ul>
<li>Added new control "link"</li>

View file

@ -0,0 +1,83 @@
[Settings]
NumFields=9
[Field 1]
Type=Groupbox
Text="This is a group box..."
Left=0
Right=-1
Top=0
Bottom=-4
[Field 2]
Type=Checkbox
Text=Install support for X
Flags=NOTIFY
State=1
Left=10
Right=100
Top=17
Bottom=25
[Field 3]
Type=Checkbox
Text=Install support for Y
State=0
Left=10
Right=100
Top=30
Bottom=38
[Field 4]
Type=Checkbox
Text=Install support for Z
State=0
Left=10
Right=100
Top=43
Bottom=51
[Field 5]
Type=FileRequest
Flags=GROUP|FILE_MUST_EXIST|FILE_EXPLORER|FILE_HIDEREADONLY
State=C:\poop.poop
Filter=Poop Files|*.poop|All files|*.*
Left=10
Right=-10
Top=56
Bottom=69
[Field 6]
Type=DirRequest
Text=Select a directory...
State=C:\Program Files\NSIS
Left=10
Right=-10
Top=74
Bottom=87
[Field 7]
Type=Label
Text=This is a label...
Left=10
Right=-10
Top=89
Bottom=97
[Field 8]
Type=Text
Flags=MULTILINE|VSCROLL|WANTRETURN|NOWORDWRAP
State="Multiline\r\nedit..."
Left=10
Right=-10
Top=97
Bottom=118
[Field 9]
Type=Button
Flags=NOTIFY
Text=Clear
Left=-60
Right=-10
Top=27
Bottom=41

View file

@ -0,0 +1,105 @@
; InstallOptions script demonstrating custom buttons
;----------------------------------------------------
!include WinMessages.nsh
Var hwnd ; Window handle of the custom page
; The name of the installer
Name "InstallOptions Test"
; The file to write
OutFile "TestNotify.exe"
; Show install details
ShowInstDetails show
; Called before anything else as installer initialises
Function .onInit
; Extract InstallOptions files
; $PLUGINSDIR will automatically be removed when the installer closes
InitPluginsDir
File /oname=$PLUGINSDIR\test.ini "testnotify.ini"
FunctionEnd
; Our custom page
Page custom ShowCustom LeaveCustom ": Testing InstallOptions"
Function ShowCustom
; Initialise the dialog but don't show it yet
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\test.ini"
; In this mode InstallOptions returns the window handle so we can use it
Pop $hwnd
; Now show the dialog and wait for it to finish
InstallOptions::show
; Finally fetch the InstallOptions status value (we don't care what it is though)
Pop $0
FunctionEnd
Function LeaveCustom
; At this point the user has either pressed Next or one of our custom buttons
; We find out which by reading from the INI file
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Settings" "State"
StrCmp $0 0 validate ; Next button?
StrCmp $0 2 supportx ; "Install support for X"?
StrCmp $0 9 clearbtn ; "Clear" button?
Abort ; Return to the page
supportx:
; Make the FileRequest field depend on the first checkbox
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 2" "State"
GetDlgItem $1 $hwnd 1204 ; PathRequest control (1200 + field 5 - 1)
EnableWindow $1 $0
GetDlgItem $1 $hwnd 1205 ; ... button (the following control)
EnableWindow $1 $0
Abort ; Return to the page
clearbtn:
; Clear all text fields
GetDlgItem $1 $hwnd 1204 ; PathRequest control (1200 + field 5 - 1)
SendMessage $1 ${WM_SETTEXT} 0 "STR:"
GetDlgItem $1 $hwnd 1206 ; DirRequest control (1200 + field 6 - 1 + 1 browse button)
SendMessage $1 ${WM_SETTEXT} 0 "STR:"
GetDlgItem $1 $hwnd 1209 ; DirRequest control (1200 + field 8 - 1 + 2 browse buttons)
SendMessage $1 ${WM_SETTEXT} 0 "STR:"
Abort ; Return to the page
validate:
; At this point we know the Next button was pressed, so perform any validation
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 2" "State"
StrCmp $0 1 done
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 3" "State"
StrCmp $0 1 done
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 4" "State"
StrCmp $0 1 done
MessageBox MB_ICONEXCLAMATION|MB_OK "You must select at least one install option!"
Abort
done:
FunctionEnd
; Installation page
Page instfiles
Section
;Get Install Options dialog user input
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 2" "State"
DetailPrint "Install X=$0"
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 3" "State"
DetailPrint "Install Y=$0"
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 4" "State"
DetailPrint "Install Z=$0"
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 5" "State"
DetailPrint "File=$0"
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 6" "State"
DetailPrint "Dir=$0"
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 8" "State"
DetailPrint "Info=$0"
SectionEnd

View file

@ -478,7 +478,7 @@ SectionEnd
Section "InstallOptions" SecPluginsIO
SetDetailsPrint textonly
DetailPrint "Installing Plug-inss | InstallOptions..."
DetailPrint "Installing Plug-ins | InstallOptions..."
SetDetailsPrint listonly
SectionIn 1 2
@ -492,6 +492,8 @@ Section "InstallOptions" SecPluginsIO
File ..\contrib\installoptions\test.nsi
File ..\contrib\installoptions\testlink.ini
File ..\contrib\installoptions\testlink.nsi
File ..\contrib\installoptions\testnotify.ini
File ..\contrib\installoptions\testnotify.nsi
SectionEnd
Section "Math" SecPluginsMath

Binary file not shown.