Archive: Real-time Textbox Update


Real-time Textbox Update
So, since the UNC path thing is not working for me, I made my own directory page using NSD.


My question to yall is,

Is there a way that when I select a path from a "browse" button, that it will show up in the text box, and will keep updating if I were to change the path.

Here is the code that I have for the 2 functions:

Function install
nsDialogs::Create 1018

${NSD_CreateButton} 230u 59u 50u 14u "Browse"
Pop $1
${NSD_OnClick} $1 MyDirHandler

${NSD_CreateText} 20u 60u 200u 12u ""

${NSD_CreateLabel} 10u 0u 280u 30u "Setup will install ASIM Bridge in the following folder.To install in a different folder, click Browse and select another folder. Click Install to start the installation."

${NSD_CreateLabel} 20u 50u 200u 12u "Destination Folder"
${NSD_CreateLabel} 75u 125u 200u 15u "For Technical Support, Please Call (888) 123-4567"




GetDlgItem $0 $HWNDPARENT 1
SendMessage $0 ${WM_SETTEXT} 0 "STR:Next"
nsDialogs::Show

FunctionEnd

Function MyDirHandler
nsDialogs::SelectFolderDialog /NOUNLOAD $R4 $R2
Pop $2
${NSD_CreateText} 20u 60u 200u 12u "123123"
FunctionEnd



Ive got it working the way I want, grabbing the install path, I just want to make sure that it shows up properly each time so the user can see whats going on.



Thanks a ton, everyone here has been amazing with helping me out!


You should create a variable for the textbox, and pop it after creating the textbox.
Then, in your MyDirHandler function you should use NSD_SetText instead of creating the textbox over and over again.
Like:

Var FolderTextbox

Function install
nsDialogs::Create 1018

${NSD_CreateButton} 230u 59u 50u 14u "Browse"
Pop $1
${NSD_OnClick} $1 MyDirHandler

${NSD_CreateText} 20u 60u 200u 12u ""
Pop $FolderTextbox

${NSD_CreateLabel} 10u 0u 280u 30u "Setup will install ASIM Bridge in the following folder.To install in a different folder, click Browse and select another folder. Click Install to start the installation."

${NSD_CreateLabel} 20u 50u 200u 12u "Destination Folder"
${NSD_CreateLabel} 75u 125u 200u 15u "For Technical Support, Please Call (888) 123-4567"

GetDlgItem $0 $HWNDPARENT 1
SendMessage $0 ${WM_SETTEXT} 0 "STR:Next"
nsDialogs::Show
FunctionEnd

Function MyDirHandler
${NSD_GetText} $FolderTextbox $0 ;Get initial folder
nsDialogs::SelectFolderDialog "Select your folder" $0
Pop $1
; Check A Folder Has Been Selected
${If} $1 != "error"
${NSD_SetText} $FolderTextbox $1
${EndIf}
FunctionEnd

Works perfectly, thank you so much!