Archive: finishpage cancel button not funtioning


finishpage cancel button not funtioning
Using mui2, and
!define MUI_FINISHPAGE_RUN $UserDir\myProg.exe
!define MUI_FINISHPAGE_CANCEL_ENABLED

My finish page is displayed correctly with the Cancel button enabled, but when I click on it nothing happens. Do I need to implement code behind the Cancel button or should it just automatically cancel/exit without running the defined executable?


The "Run myprog" option on the finish page is a checkbox. If you leave it unchecked and click Finish, the installer will exit. If you check it and click Finish, the installer will exit and myprog will be started. What more functionality do you need?


single click exit
Trying to streamline so that only one click is needed if the optional run is not desired. The question however, is why the Cancel doesn't do anything when it is enabled.


You can't cancel the install, you already completed the install, there is nothing to cancel


Originally posted by tubecharger
Trying to streamline so that only one click is needed if the optional run is not desired.
!define MUI_FINISHPAGE_RUN_NOTCHECKED


It's all in the manual. Or, in this case, in the MUI2 readme: http://nsis.sourceforge.net/Docs/Mod...02/Readme.html

finishpage cancel button not functioning
Directly from the manual:
MUI_FINISHPAGE_CANCEL_ENABLED
Enable the Cancel button so the user can skip any options displayed on the finish page.

This is exactly what I want to do and what I currently have implemented in my code. But when I click on the Cancel button which is not grayed out, nothing happens. Is this the correct behavior? Comparing the behavior to the explanation from the manual, it does not appear to be correct. Is there something else that I need to do to get the cancel button to "skip any options displayed on the finish page" and exit. I don't need it to roll back. I just want to exit without running the myProg.exe.


Originally posted by tubecharger
Directly from the manual:
MUI_FINISHPAGE_CANCEL_ENABLED
Enable the Cancel button so the user can skip any options displayed on the finish page.

This is exactly what I want to do and what I currently have implemented in my code. But when I click on the Cancel button which is not grayed out, nothing happens. Is this the correct behavior? Comparing the behavior to the explanation from the manual, it does not appear to be correct. Is there something else that I need to do to get the cancel button to "skip any options displayed on the finish page" and exit. I don't need it to roll back. I just want to exit without running the myProg.exe.
It works fine in MUI1, probably a bug in MUI2 or nsDialogs.

Try this workaround:

!include MUI2.nsh
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
#Do NOT use MUI_FINISHPAGE_CANCEL_ENABLED
!define MUI_FINISHPAGE_RUN "$windir\explorer.exe"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW NSIS2d46_MUI2_CancelEnabledFix
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"

!ifndef SC_CLOSE
!define SC_CLOSE 0xF060
!endif
Function NSIS2d46_MUI2_CancelEnabledFix
EnableWindow $mui.Button.Cancel 1
System::Call 'USER32::GetSystemMenu(i $hwndparent,i0)i.s'
System::Call 'USER32::EnableMenuItem(is,i${SC_CLOSE},i0)'
FunctionEnd

Thanks very much Anders. That worked!