- 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:
parent
c0e8dc4f73
commit
6b73b0e490
7 changed files with 686 additions and 462 deletions
105
Contrib/InstallOptions/testnotify.nsi
Normal file
105
Contrib/InstallOptions/testnotify.nsi
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue