Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   nsdialogs browse for folder (http://forums.winamp.com/showthread.php?t=314598)

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

pengyou 14th November 2009 14:33

I don't know much about nsdialogs either but this seems to do what you want:
code:
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


dougcvc 14th November 2009 15:19

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


All times are GMT. The time now is 18:04.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.