Problems on creating new page in NSIS with checkbox etc
I want to insert a new page in the installation which contains two checkbox client version and server version.on clicking client version nothing special happens as of now. But if server version selected then a browse option should come to select a folder(This is not a installation folder). I am finding some difficulties to do this. I have added two checkbox a text box and browse button.In the onchange of checkbox i make browse and textbox.
But now the problem is
I want only one checkbox to be checked at a time.
When server version checked browse option should appear(which works now) ,but if it is unchecked again then that browse option should disappear.(which does not work because i was not able to write code for that)
If i click next on this page and then come back to same page using back then all controls or checkbox i checked should be as it is. But now those browse options will disappear even if server version checkbox is selected(As i have not done proper coding for this also)
So please help me to do all these things. Also help me if there any other method to do the same
; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "My application"
!define PRODUCT_VERSION "1.0"
Var Dialog
Var Text
Var Text_State
Var Checkbox
Var Checkbox1
Var Checkbox_State
Var Checkbox1_State
var /GLOBAL SOURCETEXT
var /global SOURCE
var /global BROWSESOURCE
; MUI 1.67 compatible ------
!include "MUI.nsh"
!include nsDialogs.nsh
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
Page custom InstallPageCreate checkinstdir
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\My application"
ShowInstDetails show
ShowUnInstDetails show
Var InstallPageDialog
Var InstallPage.DirRequest
Var InstallPage.BrowseButton
Var mui.WelcomePage
Var mui.WelcomePage1
Var mui.WelcomePage.Image1
Var mui.WelcomePage.Title
Var mui.WelcomePage.Text
Var ImageHandle
Var mui.WelcomePage.Title.Font
Var LINK
Var LINK.Font
Var clickinstall
Var mui.WelcomePage.Image.Bitmap
var checked
var checked1
Var CheckBox.Font
var mui.WelcomePage1.Title1
var mui.WelcomePage.Title.Font1
Function InstallPageCreate
nsDialogs::Create 1044
Pop $mui.WelcomePage
nsDialogs::SetRTL $(^RTL)
SetCtlColors $mui.WelcomePage 0xffffff 0xffffff
${NSD_CreateLabel} 120u 70u 140u 14u "Choose the intallation method"
Pop $clickinstall
SetCtlColors $clickinstall "" "ffffff"
${NSD_CreateCheckbox} 120u 90u 100% 10u "&Client version"
Pop $CheckBox
CreateFont $CheckBox.Font "$(^Font)" "08" "500"
SetCtlColors $CheckBox "" "FFFFFF"
SendMessage $CheckBox ${WM_SETFONT} $CheckBox.Font 0
GetFunctionAddress $0 OnCheckbox1
nsDialogs::OnClick $CheckBox $0
${NSD_CreateCheckbox} 120u 100u 100% 10u "&Server version"
Pop $CheckBox1
CreateFont $CheckBox.Font "$(^Font)" "08" "500"
SetCtlColors $CheckBox1 "" "FFFFFF"
SendMessage $CheckBox1 ${WM_SETFONT} $CheckBox.Font 0
GetFunctionAddress $0 OnCheckbox2
nsDialogs::OnClick $CheckBox1 $0
${If} $Checkbox_State == ${BST_CHECKED}
${NSD_Check} $Checkbox
${EndIf}
${If} $Checkbox1_State == ${BST_CHECKED}
${NSD_Check} $Checkbox1
${EndIf}
nsDialogs::Show
;Delete image from memory
${NSD_FreeImage} $mui.WelcomePage.Image.Bitmap
FunctionEnd
Function OnCheckbox2
StrCpy $SOURCE "C:\"
${NSD_CreateText} 120u 120u 80u 12u "$SOURCE"
pop $SOURCETEXT
${NSD_CreateBrowseButton} 280u 120u 35u 14u "Browse"
Pop $InstallPage.BrowseButton
${NSD_OnClick} $InstallPage.BrowseButton Browsesource
FunctionEnd
Function OnCheckbox1
FunctionEnd
Function checkinstdir
${NSD_GetText} $Text $Text_State
${NSD_GetState} $Checkbox $Checkbox_State
${If} $Checkbox_State == ${BST_CHECKED}
strcpy $checked 1
${else}
strcpy $checked 0
${Endif}
${NSD_GetState} $Checkbox1 $Checkbox1_State
${If} $Checkbox1_State == ${BST_CHECKED}
strcpy $checked1 1
${else}
strcpy $checked1 0
${Endif}
FunctionEnd
Function Browsesource
nsDialogs::SelectFolderDialog "Select Source Folder" "c:\"
pop $SOURCE
${NSD_SetText} $SOURCETEXT $SOURCE
FunctionEnd
Section "MainSection" SEC01
SectionEnd
Section -Post
SectionEnd