Archive: To add Checkboxes on FINISHPAGE


To add Checkboxes on FINISHPAGE
Hi
I am new to NSIS
I want to add checkboxes on my FINISHPAGE ....
one checkbox for Desktop Shortcut
and one to add icon in quick launch..

i know that i can add checkbox for Readme file
and also to run exe...

but i am not able to add checkboxes on FINISHPAGE.....

any help will be highly appreciated

Thanks
Ankur


If you're not going to use the read me check box and/or the run check box, you may use MUI_FINISHPAGE_SHOWREADME_FUNCTION and/or MUI_FINISHPAGE_RUN_FUNCTION to assign your own actions for the check boxes, see MUI documentation http://nsis.sourceforge.net/Docs/Mod...UI/Readme.html
Otherwise you should edit the iospecial.ini at runtime before the finish page appears and add desired controls.


I am using readme checkbox....other than that i need two more checkboxes for desktop shortcut and one for quick launch icon..
I made some changes in iospecail.ini....but it is not working....


Attach your INI file so we can have a look...


here is the ini file

[Settings]
Rect=1044
NumFields=5

[Field 1]
Type=bitmap
Left=0
Right=109
Top=0
Bottom=193
Flags=RESIZETOFIT

[Field 2]
Type=label
Left=120
Right=315
Top=10

[Field 3]
Type=label
Left=120
Right=315

[Field 4]
Type=CheckBox
Text=Create Shortcut on Desktop
Flags=NOTIFY
State=1
Left=120
Right=315
Top=60
Bottom=78


[Field 5]
Type=CheckBox
Flags=NOTIFY
Text=Add to Quick Launch
State=1
Left=-200
Right=-140
Top=30
Bottom=48


i added 2 checkboxes as per my requirment on this ini


;NSIS Modern User Interface
;Welcome/Finish Page Example Script
;Written by Joost Verburg

;--------------------------------
;Include Modern UI

!include "MUI.nsh"

;--------------------------------
;General

;Name and file
Name "Modern UI Test"
OutFile "WelcomeFinish.exe"

;Default installation folder
InstallDir "$PROGRAMFILES\Modern UI Test"

;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Modern UI Test" ""

;--------------------------------
;Interface Settings

!define MUI_ABORTWARNING

;--------------------------------
;Pages

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

;--------------------------------
;Modified Finish Page

!define MUI_PAGE_CUSTOMFUNCTION_PRE fin_pre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW fin_show
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE fin_leave
!define MUI_FINISHPAGE_SHOWREADME "${NSISDIR}\Docs\Modern UI\Changelog.txt"
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION Desc_ShortCut
!define MUI_FINISHPAGE_RUN_TEXT "Create Desktop Shortcut"
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Functions

Function Desc_Shortcut
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\my program.lnk" "$INSTDIR\makensisw.exe"
FunctionEnd

Function fin_show
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 6" "HWND"
SetCtlColors $0 0x000000 0xFFFFFF
FunctionEnd

Function fin_pre
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Settings" "NumFields" "6"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Type" "CheckBox"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Text" "&Create Quicklaunch Shortcut"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Left" "120"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Right" "315"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Top" "130"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Bottom" "140"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "State" "1"
FunctionEnd

Function fin_leave
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 6" "State"
StrCmp $0 "0" end
SetOutPath "$INSTDIR"
CreateShortCut "$QUICKLAUNCH\my program.lnk" "$INSTDIR\makensisw.exe"
end:
FunctionEnd

;--------------------------------
;Installer Sections

Section "Dummy Section" SecDummy

SetOutPath "$INSTDIR"

;ADD YOUR OWN FILES HERE...
File "${NSISDIR}\makensisw.exe"


;Store installation folder
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR

;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd

;--------------------------------
;Descriptions

;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."

;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section

Section "Uninstall"

;ADD YOUR OWN FILES HERE...

Delete "$INSTDIR\makensisw.exe"
Delete "$INSTDIR\Uninstall.exe"

RMDir "$INSTDIR"

DeleteRegKey /ifempty HKCU "Software\Modern UI Test"

SectionEnd

thanx a lot for the code.....


Red Wine can you please send me iospecial.ini that you used.
i am getting problem related to create desktop shortcut checkbox,as i try to uncheck or check that checkbox finish page closes.
same with read me check box.
i think this is problem related to ini.
so can u please send me that file


I haven't use any particular iospecial.ini, it is just the iospecial.ini that is used by MUI to display the welcome/finish pages. What I'm actually doing is to edit this ini at runtime in order to add the extra checkbox control.
Compile and run and examine the provided above example, everything is pretty clear I guess.
The used from MUI iospecial.ini is located inside NSIS installation directory (usually program files\nsis) at Contrib\Modern UI.


Still i am facing a problem.
i make a customize page and i place 2 checkbox on that page...
now whenever i check/uncheck those checkboxes,installer is going on next page...just like i clicked next button which i didn't
checkboxes are working fine....
i don't know why this problem is coming
any body please help me


I suspect you've added notify flag, this is the only reason I could think that causes this issue. Notify flag is veeery useful, though, you don't need it at the moment.
Again, allow me ask, did you examine the above provided example?
It's just a matter of copy/paste the code to your script.


thanx

i was using notify flag....that was creating all the problems....

thanx a lot
ya i used above code...
and now my problem is solved....
thanx again


Is it possible to force (READONLY) the checkbox for the readme.txt?


Will this technique work for the uninstaller confirm page in MUI or MUI2?


Probably, but you're better off using nsDialogs instead of InstallOptions.