| dougcvc |
14th November 2009 12:39 |
nsdialogs browse for folder
I am trying to create a browse button which brings up a select folder dialog then returns and displays the selection in a text box next to the browse button.
Is there any way of refreshing the nsdialog page?
I have only just started using nsdialogs so theres a lot i still dont understand about it and i have been stuck on this for ages.
Here is some example code which is probably the easiest way to demonstrate it.
code:
Name test
OutFile test.exe
XPStyle on
!include nsDialogs.nsh
Page custom nsDialogsPage
Page instfiles
var /global SOURCE
var /global DEST
var /global BROWSESOURCE
var /global BROWSEDEST
var /global SOURCETEXT
var /global DESTTEXT
Var Dialog
Function nsDialogsPage
#Create Dialog and quit if error
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
StrCpy $SOURCE "C:\"
StrCpy $DEST "C:\"
${NSD_CreateLabel} 0 10 100% 12u "Source"
${NSD_CreateText} 0 30 80% 12u "$SOURCE"
pop $SOURCETEXT
${NSD_CreateBrowseButton} 320 30 20% 12u "Browse"
pop $BROWSESOURCE
${NSD_CreateLabel} 0 60 100% 12u "Destination"
${NSD_CreateText} 0 80 80% 12u "$DEST"
pop $DESTTEXT
${NSD_CreateBrowseButton} 320 80 20% 12u "Browse"
pop $BROWSEDEST
${NSD_OnClick} $BROWSESOURCE Browsesource
${NSD_OnClick} $BROWSEDEST Browsedest
nsDialogs::Show
FunctionEnd
Function Browsesource
nsDialogs::SelectFolderDialog "Select Source Folder" "c:\"
pop $SOURCE
FunctionEnd
Function Browsedest
nsDialogs::SelectFolderDialog "Select Destination Folder" "c:\"
Pop $DEST
FunctionEnd
Section ""
SectionEnd
Any suggestions would be great thanks :)
|