New paging system. All scripts must be updated, but it sure is worth it. InstallOptions has two new functions initDialog and show. Docs massively updated.

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1536 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-11-01 20:34:55 +00:00
parent c3013952c0
commit 6c51b44657
25 changed files with 977 additions and 480 deletions

View file

@ -14,7 +14,7 @@ Adds a branding image on the top of the installer or on the left. Its size will
\c true|\\<b\\>false\\</b\\>
Controls whether or not installs are enabled to the root directory of a drive, or directly into a network share. Set to 'true' to change the safe behavior, which prevents users from selecting C:\\ or \\\\Server\\Share as an install (and later on, uninstall) directory. For additional directory selection page customizability, see .onVerifyInstDir (\k{onVerifyInstDir}).
Controls whether or not installs are enabled to the root directory of a drive, or directly into a network share. Set to 'true' to change the safe behavior, which prevents users from selecting C:\\ or \\\\Server\\Share as an install (and later on, uninstall) directory. For additional directory selection page customizability, see .onVerifyInstDir (\k{onverifyinstdir}).
\H{aautoclosewindow} AutoCloseWindow

View file

@ -1,4 +1,4 @@
bin\halibut.exe config.but intro.but usage.but script.but attributes.but compilerflags.but sections.but basic.but registry.but generalpurpose.but flowcontrol.but file.but misc.but string.but stack.but int.but reboot.but uninstall.but log.but sec.but functions.but labels.but var.but usection.but callback.but compiler.but defines.but plugin.but history.but modernui.but usefulfunc.but license.but
bin\halibut.exe config.but intro.but usage.but script.but attributes.but compilerflags.but pages.but sections.but basic.but registry.but generalpurpose.but flowcontrol.but file.but misc.but string.but stack.but int.but reboot.but uninstall.but log.but sec.but functions.but labels.but var.but usection.but callback.but compiler.but defines.but plugin.but history.but modernui.but usefulfunc.but license.but
@del *.hlp
@del *.cnt
@copy Contents.html index.html

View file

@ -4,6 +4,22 @@ You can create callback functions which have special names, that will be called
\H{instcallbacks} Install Callbacks
\S{onguiinit} .onGUIInit
This callback will be called just before the first page is loaded and the installer dialog is shown, allowing you to tweak the the user interface.
Example:
\c !insertmacro ${NSISDIR}\Examples\WinMessages.NSH
\c
\c Funciton .onGUIInit
\c # 1028 is the id of the branding text control
\c GetDlgItem $R0 $HWNDPARENT 1028
\c CreateFont $R1 "Tahoma" 10 700
\c SendMessage $R0 ${WM_SETFONT} $R1 0
\c SetStaticBkColor $R0 0x00FFFFFF
\c FunctionEnd
\S{oninit} .onInit
This callback will be called when the installer is nearly finished initializing. If the '.onInit' function calls Abort, the installer will quit instantly.
@ -26,11 +42,7 @@ or:
\c NoAbort:
\c FunctionEnd
\S{oninitdialog} .onInitDialog
This callback is called right after an inner dialog is created (excluding InstallOptions dialogs) and before it is shown. Useful for CreateFont, SetStaticBkColor and any other last minute text changes.
\S{onInstFailed} .onInstFailed
\S{oninstfailed} .onInstFailed
This callback is called when the user hits the 'cancel' button after the install has failed (if it could not extract a file, or the install script used the Abort command).
@ -40,7 +52,7 @@ Example:
\c MessageBox MB_OK "Better luck next time."
\c FunctionEnd
\S{onInstSuccess} .onInstSuccess
\S{oninstsuccess} .onInstSuccess
This callback is called when the install was successful, right before the install window closes (which may be after the user clicks 'Close' if AutoCloseWindow is set to false).
@ -52,7 +64,7 @@ Example:
\c NoReadme:
\c FunctionEnd
\S{onMouseOverSection} .onMouseOverSection
\S{onmouseoversection} .onMouseOverSection
This callback is called whenever the mouse position over the sections tree has changed. This allows you to set a description for each section for example. The section id on which the mouse is over currently is stored, temporarly, in $0.
@ -69,38 +81,7 @@ Example:
\c SendMessage $R0 $\{WM_SETTEXT\} 0 "second section description"
\c FunctionEnd
\S{onNextPage} .onNextPage
Called when the user selects to go from one page to the next. Also called when the first page is shown (after .onInit). Call Abort from this callback in order to make the installer stay on the current page (or to make it move relative to the current page - Abort 0 means to stay put, Abort 1 means to go to the next page, Abort 2 means to go to the following page, Abort -1 means to go back a page, and so on). To figure out which page you are on, you can just keep a counter and increment it on .onNextPage, and decrement it on .onPrevPage. Note that if the directory selection page is disabled, .onNextPage and .onPrevPage are still called for it.
Example use of .onNextPage/.onPrevPage/.onInit:
\c Function .onInit
\c StrCpy $9 0 ; we start on page 0
\c FunctionEnd
\c Function .onNextPage
\c StrCmp $9 1 "" noabort
\c MessageBox MB_YESNO "advance to the second page?" IDYES noabort
\c Abort
\c noabort:
\c IntOp $9 $9 + 1
\c FunctionEnd
\c Function .onPrevPage
\c StrCmp $9 2 "" noabort
\c MessageBox MB_YESNO "go back to the first page?" IDYES noabort
\c Abort
\c noabort:
\c IntOp $9 $9 - 1
\c FunctionEnd
\S{onPrevPage} .onPrevPage
Called when the user selects to go from one page to the previous. Call Abort from this callback in order to make the installer stay on the current page (or pass an integer parameter to Abort to specify how many pages to move: Abort 1 means to go back one page, Abort 2 means to go back two pages, Abort -1 means to go forward a page, and so on). See .onNextPage for more information.
\S{onSelChange} .onSelChange
\S{onselchange} .onSelChange
Called when the selection changes on the component page. Useful for using with SectionSetFlags and SectionGetFlags.
@ -116,7 +97,7 @@ Example:
\c NoCancelAbort:
\c FunctionEnd
\S{onVerifyInstDir} .onVerifyInstDir
\S{onverifyinstdir} .onVerifyInstDir
This callback enables control over whether or not an installation path is valid for your installer. This code will be called every time the user changes the install directory, so it shouldn't do anything crazy with MessageBox or the likes. If this function calls Abort, the installation path in $INSTDIR is deemed invalid.
@ -130,6 +111,12 @@ Example:
\H{uninstcallbacks} Uninstall Callbacks
\S{unonguiinit} un.onGUIInit
This callback will be called just before the first page is loaded and the installer dialog is shown, allowing you to tweak the the user interface.
Have a look at .onGUIInit (\K{onguiinit}) for an example.
\S{unonInit} un.onInit
This callback will be called when the uninstaller is nearly finished initializing. If the 'un.onInit' function calls Abort, the uninstaller will quit instantly. Note that this function can verify and/or modify $INSTDIR if necessary.
@ -151,16 +138,7 @@ or:
\c found:
\c FunctionEnd
\S{unonInitDialog} un.onInitDialog
This callback is called right after an inner dialog is created (excluding InstallOptions dialogs) and before it is shown. Useful for CreateFont, SetStaticBkColor and any other last minute text changes.
\S{unonNextPage} un.onNextPage
Called when the user selects 'Uninstall' or 'Close' from the uninstaller. Call Abort from this callback in order to make the uninstaller stay on the current page.
\S{unonUninstFailed} un.onUninstFailed
\S{unonuninstfailed} un.onUninstFailed
This callback is called when the user hits the 'cancel' button after the uninstall has failed (if it used the Abort command or otherwise failed).
@ -170,7 +148,7 @@ Example:
\c MessageBox MB_OK "Better luck next time."
\c FunctionEnd
\S{unonUninstSuccess} un.onUninstSuccess
\S{unonuninstsuccess} un.onUninstSuccess
This callback is called when the uninstall was successful, right before the install window closes (which may be after the user clicks 'Close' if AutoCloseWindow is set to false).
@ -180,7 +158,7 @@ Example:
\c MessageBox MB_OK "Congrats, it's gone."
\c FunctionEnd
\S{unonUserAbort} un.onUserAbort
\S{unonuserabort} un.onUserAbort
This callback is called when the user hits the 'cancel' button and the uninstall hasn't already failed. If this function calls Abort, the install will not be aborted.

View file

@ -1,22 +1,22 @@
\C{flowcontrol} Flow Control Instructions
\H{Abort} Abort
\H{abort} Abort
\c user_message
Cancels the install, stops execution of script, and displays user_message in the status display. Note: you can use this from Callback Functions (\k{callbacks}) to do special things. Note 2: When using from .onNextPage (\k{onNextPage}) or .onPrevPage (\k{onPrevPage}), the parameter to Abort can be an integer that specifies how many pages to skip.
Cancels the install, stops execution of script, and displays user_message in the status display. Note: you can use this from Callback Functions (\k{callbacks}) to do special things. Pages callbacks (\K{pages}) also uses Abort for special purposes.
\H{Call} Call
\H{call} Call
\c function_name | :label_name
Calls the function named function_name. If in the Uninstall section, Call can only be used with function names beginning with "un.". If the parameter starts with a ':' it will be treated as a label (so you can call to a label in your function - this is probably not going to be used most of the time).
\H{ClearErrors} ClearErrors
\H{clearerrors} ClearErrors
Clears the error flag.
\H{FindWindow} FindWindow
\H{findwindow} FindWindow
\c user_var(hwnd output) windowclass [windowtitle] [windowparent] [childafter]
@ -28,13 +28,13 @@ Searches for a window. Behaves like the win32 FindWindowEx(). Seaches by windowc
Gets the address of the current instruction (the GetCurrentAddress) and stores it in the output user variable. This user variable then can be passed to Call or Goto.
\H{GetDlgItem} GetDlgItem
\H{getdlgitem} GetDlgItem
\c user_var(output) dialog item_id
Retrieves the handle of a control identified by item_id in the specified dialog box dialog. If you want to get the handle of a control on the inner dialog, first use FindWindow user_var(output) "#32770" "" $HWNDPARENT to get the handle of the inner dialog.
\H{GetFunctionAddress} GetFunctionAddress
\H{getfunctionaddress} GetFunctionAddress
\c user_var(output) function_name
@ -56,37 +56,37 @@ If +offset or -offset is specified, jump is relative by offset instructions. Got
If a user variable is specified, jumps to absolute address (generally you will want to get this value from a function like GetLabelAddress. I Compiler flag commands and SectionIn aren't instructions so jumping over them has no effect.
\H{IfErrors} IfErrors
\H{iferrors} IfErrors
\c jumpto_iferror [jumpto_ifnoerror]
Checks and clears the error flag, and if it is set, it will goto jumpto_iferror, otherwise it will goto jumpto_ifnoerror. The error flag is set by other instructions when a recoverable error (such as trying to delete a file that is in use) occurs.
\H{IfFileExists} IfFileExists
\H{iffileexists} IfFileExists
\c file_to_check_for jump_if_present [jump_otherwise]
Checks for existence of file(s) file_to_check_for (which can be a wildcard, or a directory), and Gotos jump_if_present if the file exists, otherwise Gotos jump_otherwise. If you want to check to see if a file is a directory, use IfFileExists DIRECTORY\\*.*
\H{IntCmp} IntCmp
\H{intcmp} IntCmp
\c val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]
Compares two integers val1 and val2. If val1 and val2 are equal, Gotos jump_if_equal, otherwise if val1 < val2, Gotos jump_if_val1_less, otherwise if val1 > val2, Gotos jump_if_val1_more.
\H{IntCmpU} IntCmpU
\H{intcmpu} IntCmpU
\c val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]
Compares two unsigned integers val1 and val2. If val1 and val2 are equal, Gotos jump_if_equal, otherwise if val1 < val2, Gotos jump_if_val1_less, otherwise if val1 > val2, Gotos jump_if_val1_more. Performs the comparison as unsigned integers.
\H{IsWindow} IsWindow
\H{iswindow} IsWindow
\c HWND jump_if_window [jump_if_not_window]
If HWND is a window, Gotos jump_if_window, otherwise, Gotos jump_if_not_window (if specified).
\H{MessageBox} MessageBox
\H{messagebox} MessageBox
\c mb_option_list messagebox_text [return_check jumpto] [return_check_2 jumpto_2]
@ -144,11 +144,11 @@ Return_check can be 0 (or empty, or left off), or one of the following:
If the return value of the MessageBox is return_check, the installer will Goto jumpto.
\H{Return} Return
\H{return} Return
Returns from a function or section.
\H{SendMessage} SendMessage
\H{sendmessage} SendMessage
\c HWND msg wparam lparam [user_var(return value)] [/TIMEOUT=time_in_ms]
@ -166,15 +166,15 @@ To send a string param, put STR: before the parameter, for example: "STR:Some st
Use /TIMEOUT=time_in_ms to specify the duration, in milliseconds, of the time-out period.
\H{Quit} Quit
\H{quit} Quit
Causes the installer to exit as soon as possible. After Quit is called, the installer will exit (no callback functions will get a chance to run).
\H{SetErrors} SetErrors
\H{seterrors} SetErrors
Sets the error flag.
\H{StrCmp} StrCmp
\H{strcmp} StrCmp
\c str1 str2 jump_if_equal [jump_if_not_equal]

View file

@ -2,6 +2,12 @@
\e{v2.0b0}
\b New paging system
\b Added Page and UninstPage
\b Removed .onNextPage, .onPrevPage, .onInitDialog
\b New easier version of the Modern User Interface with better multilanguage support, InstallOptions integration etc.
\b Added accelerator keys

View file

@ -4,59 +4,59 @@
Makes the installer window visible and brings it to the top of the window list (i.e. if a command was executed that shows itself in front of the installer, a BringToFront would bring the installer back in focus).
\H{CreateFont} CreateFont
\H{createfont} CreateFont
\c user_var(handle output) face_name [height] [weight] [/ITALIC] [/UNDERLINE] [/STRIKE]
Creates a font and puts its handle into user_var. For more information about the different parameters have a look at \W{http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_8fp0.asp}{MSDN's page about the Win32 API function CreateFont()}.
\H{DetailPrint} DetailPrint
\H{detailprint} DetailPrint
\c user_message
Adds the string "user_message" to the details view of the installer.
\H{HideWindow} HideWindow
\H{hidewindow} HideWindow
Hides the installer.
\H{SetAutoClose} SetAutoClose
\H{setautoclose} SetAutoClose
\c true|false
Overrides the default auto window-closing flag (specified for the installer using AutoCloseWindow, and false for the uninstaller). Specify 'true' to have the install window immediately disappear after the install has completed, or 'false' to make it require a manual close.
\H{SetBrandingImage} SetBrandingImage
\H{setbrandingimage} SetBrandingImage
\c [/IMGID=item_id_in_dialog] [/RESIZETOFIT] path_to_bitmap_file.bmp
Sets the current bitmap file displayed as the branding image. If no IMGID is specified, the first image control found will be used, or the image control created by AddBrandingImage. Note that this bitmap must be present on the user's machine. Use File first to put it there. If /RESIZETOFIT is specified the image will be automatically resized (very poorly) to the image control size. If you used AddBrandingImage you can get this size, by compiling your script and watching for AddBrandingImage output, it will tell you the size. SetBrandingImage will not work when called from .onInit!
\H{SetDetailsView} SetDetailsView
\H{setdetailsview} SetDetailsView
\c show|hide
Shows or hides the details, depending on which parameter you pass. Overrides the default details view, which is set via ShowInstDetails
\H{SetDetailsPrint} SetDetailsPrint
\H{setdetailsprint} SetDetailsPrint
\c none|listonly|textonly|both|lastused
Sets mode at which commands print their status. None has commands be quiet, listonly has status text only added to the listbox, textonly has status text only printed to the status bar, and both enables both (the default). For extracting many small files, textonly is recommended (especially on win9x with smooth scrolling enabled).
\H{SetShellVarContext} SetShellVarContext
\H{setshellvarcontext} SetShellVarContext
\c current|all
Sets the context of $SMPROGRAMS and other shell folders. If set to 'current' (the default), the current user's shell folders are used. If set to 'all', the 'all users' shell folder is used. The all users folder may not be supported on all OSes. If the all users folder is not found, the current user folder will be used.
\H{SetStaticBkColor} SetStaticBkColor
\H{setstaticbkcolor} SetStaticBkColor
\c hwnd color
Sets a background color for a static control. Use GetDlgItem to get the handle (HWND) of the static control.
\H{Sleep} Sleep
\H{sleep} Sleep
\c sleeptime_in_ms

68
Docs/src/pages.but Normal file
View file

@ -0,0 +1,68 @@
\C{pages} Pages
Each (non-silent) NSIS installer has a set of pages. Each page can be a NSIS built-in page or a custom page created by a user's function (with InstallOptions for example).
\H{pageoreder} Ordering
The page order is set simply by the order they are in the script. For example:
\c Page license
\c Page components
\c Page directory
\c Page instfiles
This code will show the license page, then the components selction page, then the directory selection page and then the install log, just like in old installers.
Please note that you must still use LicenseText and LicenseData for the license page to show, ComponentText for the components selection page to show and DirText for the directory page to show.
If you don't use any Page command the installer pages order will be just as in older version: license (if LicenseText and LicenseData were specified), components (if ComponentText was specified and there is more than one visible section), directory (if DirText was specified), instfiles.
\H{pagecallbacks} Callbacks
Each built-in page has two callback functions. The pre-function and the post-creation function. The pre-function is called right before the page is created and the post-function is called right after it is created and before it is showed so you can tweak its user interface with CreateFont (\K{createfont}), SetStaticBkColor (\K{setstaticbkcolor}) and SendMessage (\K{sendmessage}).
A custom page has only one callback function that creates it but unlike the built-in pages this function is mandatory.
Abort (see \K{abort}) has special usage from pages' callback functions.
\b Use Abort from a built-in pre-function to skip the page
\b Use Abort from a custom page creator function to go to the previous page
Examples:
\c Page license skipLicense
\c Page custom customPage
\c Page instfiles
\c
\c Function skipLicense
\c MessageBox MB_YES "Do you want to skip the license page?" IDNO no
\c Abort
\c no:
\c FunctionEnd
\c
\c Function customPage
\c GetTempFileName $R0
\c File /oname=$R0 customPage.ini
\c InstallOptions::dialog $R0
\c Delete $R0
\c Pop $R1
\c StrCmp $R1 "cancel" "" nocancel
\c Quit
\c nocancel:
\c StrCmp $R1 "back" "" noback
\c Abort
\c noback:
\c FunctionEnd
\H{page} Page
\c custom function | (license|components|directory|instfiles) [pre_function] [post_function]
Adds an installer page. See the above sections for more information about built-in versus custom pages and about callback functions.
\H{uninstpage} UninstPage
\c custom function | (uninstConfirm|instfiles) [pre_function] [post_function]
Adds an uninstaller page. See the above sections for more information about built-in versus custom pages and about callback functions.