- NSIS Discussion
- Cancel button issue with multiple custom pages
Archive: Cancel button issue with multiple custom pages
zbd
11th December 2006 23:45 UTC
Cancel button issue with multiple custom pages
Hi, I have a few custom pages in my installer, all doing different things, but if the user clicks "Cancel" on any of these pages, it just takes them to the next page (it shows the abort message too). Just wondering if i can make the "Cancel" button directly exit the installer, or exit normally, or just at all would be great.
The function for the custom pages are like this but it happens with all the custom pages it seems:
Function InstallMap
call InstallMapData
${If} $need_map == "no"
goto map_exists
${ElseIf} $need_map == "yes"
Call InstallMapPack
;Display the InstallOptions dialog
InstallOptions::dialog "$PLUGINSDIR\installmap.ini"
Pop $0
${EndIf}
map_exists:
FunctionEnd
thanks for any help
-zbd
bholliger
12th December 2006 00:43 UTC
Hi zbd!
Could you attach the whole piece of code?
Cheers
Bruno
zbd
12th December 2006 01:04 UTC
script attached
Hi again Bruno,
I must warn this is very mashed up and a lot of unnecessary stuff in there, i will try and tell u which lines the things that matter are.
Script is attached...
Line ~ 50 - 70 - Var's i'm using for the pages
Line 124 - 131 - Custom pages
Line 162 - 240 - Custom page Functions
Line 335 - 340 - InstallCAB used in most of the custom pages
Line 420 - 500 - One of the components being checked and installed
Line 464 - Variable being set to show page or not
Line 841 - 875 - .onInit ini files etc being extracted/reserved
It just seems strange to me that it will give me the abort warning message when i click "Cancel", then i click yes and it just goes to the next page.
Hope you can help, thanks
Zbd
bholliger
12th December 2006 01:31 UTC
Hi zbd!
I couldn't spot anything wrong. Is it working with MUI? I don't know XPUI, sorry.
Cheers
Bruno
zbd
12th December 2006 01:48 UTC
I think its almost exactly the same, but yeah i'm using a skinning system with XPUI, Its very strange, seems to happen with every custom page.
Is there a way i can make a custom AbortWarning?
I would have to detect when they clicked the Cancel button tho
Thanks Bruno
bholliger
12th December 2006 01:54 UTC
Hi zbd!
Hmmm, this behaviour is really weird!
It is possible to create your own abort warning. Write your code in the .onUserAbort callback function:
Function .onUserAbort
MessageBox MB_YESNO "Abort install?" IDYES NoCancelAbort
Abort ; causes installer to not quit.
NoCancelAbort:
FunctionEnd
Cheers
Bruno
zbd
12th December 2006 01:59 UTC
sorry, newb-ness kicking in,
I tried just putting that function in my code, it says it exists already? i cant find it
bholliger
12th December 2006 02:06 UTC
Ok, XPUI must have occupied this function for its own stuff. Have a look into the documentation of XPUI. It might provide the possibility to create your own function.
MUI has a similar behaviour with .onGUIInit. If you want to execute your own code, you have to create your own myGUIInit function and introduce a line like this one:
!define MUI_CUSTOMFUNCTION_GUIINIT myGUIInit
Cheers
Bruno
zbd
12th December 2006 02:22 UTC
Ur a champ Bruno, it's almost doing what i want now, i just renamed that last .onUserAbort func and included !define MUI_CUSTOMFUNCTION_ABORT "UserAbort" so it is using the Function you gave.
It is now closing the installer as soon as i press Cancel, there is no Abort Warning, but I can deal with that i hope.
Thanks for ur help, its very much appreciated.
Zbd
bholliger
12th December 2006 02:25 UTC
You're welcome.
Well I guess you could use this code anyway.
Function UserAbort
MessageBox MB_YESNO "Abort install?" IDYES NoCancelAbort
Abort ; causes installer to not quit.
NoCancelAbort:
FunctionEnd
Cheers
Bruno
zbd
12th December 2006 02:27 UTC
Yeah, willdo
thanks again mate, Zbd