Skip to content
⌘ NSIS Forum Archive

MUI: how to disable Cancel/Back on a page given

6 posts

Yurik#

MUI: how to disable Cancel/Back on a page given

Hi,

how can I disable Cancel/Back buttons on particular page in MUI if I can?
Thanks!
Afrow UK#
You can disable the cancel and/or back buttons on the Welcome or Finish page by using:
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "BackEnable" "0"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "CancelEnable" "0"
These should be called on the Welcome/Finish page Pre functions.

Remember to write "1" to Settings>ioSpecial.ini in the Welcome page's Leave function too (to re-enable the buttons). Else you might find the buttons are disabled on the Finish page too!

For any other pages, this is not possible as the Welcome and Finish pages are the only MUI pages that use InstallOptions.

-Stu
Anders#
should be possible on other pages aswell using the MUI_PAGE_CUSTOMFUNCTION_PRE or
MUI_PAGE_CUSTOMFUNCTION_SHOW defines and using EnableWindow on the button

(didnt test this)
Yurik#
Originally posted by Anders
should be possible on other pages aswell using the MUI_PAGE_CUSTOMFUNCTION_PRE or
MUI_PAGE_CUSTOMFUNCTION_SHOW defines and using EnableWindow on the button

(didnt test this)
It works! The was only one problem that I didn't know ids for Cancel and Back and determined them after some experiments. So final pre-function for pages that needs to be back/cancel disabled is

Function DisableBackCancel
GetDlgItem $DlgItem $HWNDPARENT 2 ; Cancel button
EnableWindow $DlgItem 0

GetDlgItem $DlgItem $HWNDPARENT 3 ; Back button
EnableWindow $DlgItem 0
FunctionEnd
hgerstung#
Just for the archive (if someone like me gets into this thread by using the search function):
I found out that you actually have to use

!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "BackEnabled" "0"
(the Setting is called BackEnabled ...)

Kind regards,
Heiko