Archive: nsdialogs browse for folder


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.




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 :)

I don't know much about nsdialogs either but this seems to do what you want:

Function Browsesource
nsDialogs::SelectFolderDialog "Select Source Folder" "c:\"
pop $SOURCE
${NSD_SetText} $SOURCETEXT $SOURCE
FunctionEnd

Function Browsedest
nsDialogs::SelectFolderDialog "Select Destination Folder" "c:\"
Pop $DEST
${NSD_SetText} $DESTTEXT $DEST
FunctionEnd

nice one thank u so much nice and simple knew i was missing something stupid. :D