Archive: Why is there an enabled cancel button in the finish page?


Why is there an enabled cancel button in the finish page?
Why is there an enabled cancel button in the finish page?

I'm using the modern UI. Any tips on how to disable the cancel button in the finish page?


Good point.
If the installation end *succesfully*,
both cancel and finish are up.
Why noy desable one of them?

BTW: Welcome to the Forums tupper :D


Try adding this into an install section (preferably a last one) It will grey out the cancel button.


!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "CancelEnable" "0"


Optionally, you could completely remove the cancel button by doing this:

!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "CancelShow" "0"


Let me know if it works.

If it doesn't work, then try putting it in a custom finish page function like so:
!insertmacro MUI_PAGECOMMAND_FINISH "CustomFinish"
Function "CustomFinish"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "CancelEnable" "0"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "CancelShow" "0"
FunctionEnd


-Stu

Stu, thanks for the suggestions. I tried the suggestions, with mixed results.

The first approach (as follows) didn't affect the cancel button.


!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "CancelEnable" "0"


The second approach (as follows) caused a compiler error ["MUI_PAGECOMMAND_FINISH" requires 0 parameter(s)]

!insertmacro MUI_PAGECOMMAND_FINISH "CustomFinish"
Function "CustomFinish"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "CancelEnable" "0"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "CancelShow" "0"
FunctionEnd


The "optionally" variant of the first approach (as follows) does work. So it seems that the installer enables / disables the buttons after the last section is completed.


!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "CancelShow" "0"


It might be better to have the button visible but disabled (not sure...), but this will do fine! Thanks again!

Originally posted by Lobo Lunar
BTW: Welcome to the Forums tupper :D
Thanks :-)

Sorry, I made a typo error.
Use:


!define MUI_CUSTOMFUNCTION_FINISH_SHOW "CustomFinish"
Function "CustomFinish"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "CancelEnable" "0"
FunctionEnd

That should work fine.

-Stu

There is a cancel button on the finish page so the user will be able to cancel seeing the readme and running your program without clicking too much.


Hmm, well I was going to test it, but the Cancel button on the Finish page is already disabled!
Not sure why your's isn't?

-Stu


Originally posted by Afrow UK
Sorry, I made a typo error.
Use:

!define MUI_CUSTOMFUNCTION_FINISH_SHOW "CustomFinish"
Function "CustomFinish"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "CancelEnable" "0"
FunctionEnd

This doesn't affect the cancel button with my installer. Even replacing "CancelEnable" with "CancelShow" makes no difference. But if I replace "CancelEnable" with "CancelShow" and MUI_CUSTOMFUNCTION_FINISH_SHOW with MUI_CUSTOMFUNCTION_FINISH_PRE, then the cancel button disappears. But your earlier suggestion (putting the code in the installation section) has the same effect and seems to be a bit simpler and more logical.

Originally posted by kichik
There is a cancel button on the finish page so the user will be able to cancel seeing the readme and running your program without clicking too much.
Kichik, thanks for the explanation :-) I think I'll stick with hiding the button as pressing "Cancel" won't actually cancel (roll back) the installation.

I guess another option for me would be to add some code to change the button text (to "Stop" or "Abort" or "Close" ... ?) but I think that might be confusing for users (perhaps not if the right word was found) --- and I don't know how to do that anyway :-)

Originally posted by Afrow UK
Hmm, well I was going to test it, but the Cancel button on the Finish page is already disabled!
Not sure why your's isn't?
The button seems to be automatically disabled if you don't bring up checkboxes for running the program or for viewing the read me. This agrees with Kichik's comments (that the button allows users to avoid the horrible fate of running or looking at what they just installed ;-)

Originally posted by kichik
There is a cancel button on the finish page so the user will be able to cancel seeing the readme and running your program without clicking too much.
I've something more to add --- clicking on the close box seems to have the same effect as clicking on the cancel button. Any comments about not showing the warning / confirmation window if the installation has completed? This would allow a one-click escape. (Is this easily coded in my script?)

Thanks again :-)

Hm, only thing I can suggest, is that you..

1. In a !define MUI_CUSTOMFUNCTION_FINISH_SHOW function, copy say $9 as "done" (StrCpy $9 done)
2. Make a copy of the Contrib\Modern UI\System.nsh file and paste it as a different copy. Scroll down until you get to !macro MUI_ABORTWARNING (use search)
Replace this:


!macro MUI_ABORTWARNING

!ifndef MUI_NOVERBOSE & MUI_MANUALVERBOSE
!verbose 3
!endif

;Warning when Cancel button is pressed

MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(MUI_TEXT_ABORTWARNING)" IDYES quit
Abort
quit:

!ifndef MUI_NOVERBOSE & MUI_MANUALVERBOSE
!verbose 4
!endif

!macroend

With this.

!macro MUI_ABORTWARNING

!ifndef MUI_NOVERBOSE & MUI_MANUALVERBOSE
!verbose 3
!endif

;Warning when Cancel button is pressed

StrCmp $9 done quit

MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(MUI_TEXT_ABORTWARNING)" IDYES quit
Abort
quit:

!ifndef MUI_NOVERBOSE & MUI_MANUALVERBOSE
!verbose 4
!endif

!macroend


Make sure you !include that special modified system.nsh file instead of using the original one. It think that this should be added to the orig system.nsh.

-Stu

add
!define MUI_PAGE_CUSTOMFUNCTION_PRE OnShowFinish

Function OnShowFinish
GetDlgItem $R0 $HWNDPARENT 2
SendMessage $R0 ${WM_CLOSE} 0 0
FunctionEnd