DrWatson
10th February 2007 16:36 UTC
Jump back over a disabled page
Hi there,
disabling a certain page during install is easy. You execute 'Abort' in the page's pre_function or the custom page's creator_function.
If you press the 'Back' button in a page that follows an aborted page, the aborted page's pre_function is called and the 'Abort' is executed again which results in an exit of the installer.
In this situation I would need the information that the page which will be aborted is called from the next page of the wizard and I would need a command to call the previous page before aborting.
Is that possible in any way ?
Thanks a lot for every help.
Red Wine
10th February 2007 20:06 UTC
If you press the 'Back' button in a page that follows an aborted page, the aborted page's pre_function is called and the 'Abort' is executed again which results in an exit of the installer.
This happens only when the 'aborted page' is the 1st page in pages sequence, and sounds quite normal if you hit back from the 2nd page then 1st is aborted, where do you think it should jump?
If you want to avoid the possible back thus the end of the installer, you should add some code that disables the back button in 2nd page to cover this case.
There is a related example at wiki,
http://nsis.sourceforge.net/Demonstr...Pre_Show_LeaveDrWatson
11th February 2007 08:48 UTC
Unfortunately it's not the first page in the page sequence:
!insertmacro MUI_PAGE_WELCOME
Page custom MUI_CUST_UPGRADE
!insertmacro MUI_PAGE_LICENSE "$(TEXT_License)"
...
Function MUI_CUST_UPGRADE
;If VersionCheck detects no installed version, this page needs not to be shown
${If} $CURRENT_VERSION == ""
Abort
${EndIf}
;Otherwise display warning message on page
!insertmacro MUI_HEADER_TEXT "$(TEXT_UpgradeTitle)" "$(TEXT_UpgradeSubTitle)"
...
The jump should go back from the license page to the welcome page, which works well if the custom page is not programmed. In addition, all back jumps are working, if the custom page is not aborted.
Any other ideas ?
Red Wine
11th February 2007 09:21 UTC
I'd suggest check your code twice,
the following example shows a custom page when a custom install is selected and never exits the installer no matter how many back/next performed.
OutFile 'test.exe'
InstallDir "$PROGRAMFILES\boo"
LicenseData '${NSISDIR}\License.txt'
InstType Typical
InstType Full
Page License
Page Components
Page Custom custcreate
Page Directory
Page InstFiles
Section "common" sec1
SectionIn 1 2
SectionEnd
Section "data" sec2
SectionIn 1 2
SectionEnd
Section /o "examples" sec3
SectionIn 2
SectionEnd
Function custcreate
GetCurInstType $0
StrCmp $0 32 next
Abort
next:
InstallOptions::Dialog "$PLUGINSDIR\custom.ini"
FunctionEnd
Function .onInit
InitPluginsDir
GetTempFileName $0
Rename $0 "$PLUGINSDIR\custom.ini"
WriteINIStr "$PLUGINSDIR\custom.ini" "settings" "numfields" "1"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "type" "groupbox"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "text" "I'm a GroupBox, or not..."
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "left" "10"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "right" "-10"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "top" "10"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "bottom" "-10"
FunctionEnd