Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 29th August 2011, 09:30   #1
foomigator
Junior Member
 
Join Date: Aug 2011
Posts: 3
Customize uninstaller Confirm page using MUI2 and nsDialogs

Hi everyone!
I'm stuck trying to add a checkbox on Uninstaller Confirm page. I'm using MUI2 and nsDialogs the following way:
PHP Code:
!define name customconfirm
!include "MUI2.nsh"

OutFile      "${name}.exe"
Name         "${name}"
InstallDir   "$TEMPDIR"

var unCheckbox

Function un.MyConfirmShow
    MessageBox MB_OK 
"Showing confirm page"
    
${NSD_CreateCheckbox505010010u "&My checkbox"
    
Pop $unCheckbox
    SetCtlColors $unCheckbox 
"" "ffffff"
FunctionEnd

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!define MUI_PAGE_CUSTOMFUNCTION_SHOW un.MyConfirmShow
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

!insertmacro MUI_LANGUAGE English

Section
    WriteUninstaller 
"$EXEDIR\uninst.exe"
SectionEnd 
When I run the generated uninstaller, it shows the message box I defined, which means my custom functions is called successfully, but there's no checkbox on confirm page. At first I thought that it might be hiddden for some reason, but Spy++ reveals there's no such control created on the page. Am I missing something essential?
foomigator is offline   Reply With Quote
Old 30th August 2011, 06:15   #2
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 562
Send a message via ICQ to T.Slappy
Quote:
Am I missing something essential?
Yes
You need to use nsDialogs to create WHOLE uninstall page!
Usign ${NSD_CreateCheckbox} somewhere in code is not enough.

Creating page should look like this:
PHP Code:
Function nsDialogsPage
    nsDialogs
::Create 1018
    Pop $Dialog

    
${If} $Dialog == error
        Abort
    
${EndIf}
${
NSD_CreateCheckbox505010010u "&My checkbox"
    
Pop $unCheckbox 

    nsDialogs
::Show
FunctionEnd 
But there is more to do, see docs: http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2022: www.visual-installer.com
or RAD Studio 2009 - 11 Alexandria: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 30th August 2011, 07:44   #3
foomigator
Junior Member
 
Join Date: Aug 2011
Posts: 3
Quote:
Originally Posted by T.Slappy View Post
Yes
You need to use nsDialogs to create WHOLE uninstall page!
Usign ${NSD_CreateCheckbox} somewhere in code is not enough.
That's mighty strange, because MUI2 readme clearly states the following:
"Modern UI pages can also be customized using custom functions."
and
"nsDialogs allows you to create custom pages or customize existing pages directly from the script."
And this is true, at least partially I was able to customize uninstaller finish page this way:
PHP Code:
!define name customfinish
!include "MUI2.nsh"
!include "FileFunc.nsh"

OutFile      "${name}.exe"
Name         "${name}"
InstallDir   "$TEMPDIR"

var unCheckbox

Function un.MyFinishShow
    MessageBox MB_OK 
"Showing finish page"
    
${NSD_CreateCheckbox505010010u "&My checkbox"
    
Pop $unCheckbox
    SetCtlColors $unCheckbox 
"" "ffffff"
FunctionEnd

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!define MUI_PAGE_CUSTOMFUNCTION_SHOW un.MyFinishShow
!define MUI_FINISHPAGE_RUN ; -- Strangebut this is REQUIRED to have any controls shown on Finish page.
!
insertmacro MUI_UNPAGE_FINISH

!insertmacro MUI_LANGUAGE English

Section
    WriteUninstaller 
"$EXEDIR\un${name}.exe"
SectionEnd 
Naturally I thought this would be the way to modify uninstall Confirm page as well, but it seems it's not the case, so I decided to seek help here. I really don't want to reinvent the wheel (i.e. recreate the whole page) just to add a checkbox to one of pages existing by default
foomigator is offline   Reply With Quote
Old 30th August 2011, 13:33   #4
foomigator
Junior Member
 
Join Date: Aug 2011
Posts: 3
I actually solved the problem by following "Option A" solution found here.
foomigator is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump