Old 25th February 2015, 12:42   #1
coderwolf
Junior Member
 
Join Date: Feb 2015
Posts: 25
referencing Data entered in NSIS Dialog Designer Form

I have a form(created with NSIS Dialog Designer) with 1 checkbox, 1 groupbox, 2 RadioButtons(grouped together), 2 textboxes, 1 password, 3 Labels on it. How would I reference the data that is entered in the form.

edit: I have tried the $R0-$R4 and $0 - $4 and it gave me nothing (fnc_Config is located in DialogTest1.nsdinc)

code:

!include MUI2.nsh
!include "DialogTest1.nsdinc"

Page custom fnc_Config_Show fnc_Show_Config

Function fnc_Show_Config
MessageBox MB_OK "$R0, $R1, $R2, $R3, $R4, $0, $1"
FunctionEnd


Last edited by coderwolf; 25th February 2015 at 13:01. Reason: further clarification
coderwolf is offline   Reply With Quote
Old 25th February 2015, 13:04   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
nsDialogs.nsh has some helper functions you can use...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 25th February 2015, 13:34   #3
coderwolf
Junior Member
 
Join Date: Feb 2015
Posts: 25
Do the "handle variables" section hold the Hwnd values to be used in the GetUserData? If not , how would I get the HWND variables needed?
coderwolf is offline   Reply With Quote
Old 25th February 2015, 13:46   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
I have never used that dialog designer so I don't know. I would guess they are in that .nsdinc file...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 25th February 2015, 14:02   #5
coderwolf
Junior Member
 
Join Date: Feb 2015
Posts: 25
They are. I am not sure of all the sides of NSIS as well. I am just 3 days into using it. And there are some areas that are still confusing to me.

The relevant pieces appear to be:
(inside the nsdinc file)
code:

Var hCtl_Config_TB_FTPUser
Function fnc_Config_Create
nsDialogs::Create 1018
Pop $hCtl_Config
${If} $hCtl_Config == error
Abort
${EndIf}
!insertmacro MUI_HEADER_TEXT "Configuration" "Config"
; === TB_FTPUser (type: Text) ===
${NSD_CreateText} 68u 57u 59u 10u ""
Pop $hCtl_Config_TB_FTPUser
FunctionEnd

Function fnc_Config_Show
Call fnc_Config_Create
nsDialogs::Show $hCtl_Config
FunctionEnd



I tried this as a change to the below function in my file and it did not work.
code:

Function fnc_Show_Config
nsDialogs::GetUserData ${hwnd} hCtl_Config_TB_FTPUser
Pop $user
MessageBox MB_OK "$User"
FunctionEnd

coderwolf is offline   Reply With Quote
Old 25th February 2015, 14:27   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Pop $hCtl_Config_TB_FTPUser is the part that saves the hwnd.

I assume you got a compiler warning, don't ignore them!

nsDialogs::GetUserData $hCtl_Config_TB_FTPUser

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 26th February 2015, 20:26   #7
coderwolf
Junior Member
 
Join Date: Feb 2015
Posts: 25
this was a temporarily put aside project, however, I had another one come up that was very similar.

On the below project I am getting no results in the Variables I am trying to get the data out of. The dialog was also created by the Coolsoft NSIS Dialog Designer. What am I doing wrong?

Office Path.nsdinc(Form file) contains: (FR_*_BTN is the button of a FileRequest, FR_*_TXT is the TextBox portion of it)
Quote:
; handle variables
Var hCtl_Office_Path
Var hCtl_Office_Path_LB_ExcelEXEFile
Var hCtl_Office_Path_LBL_WordEXEFile
Var hCtl_Office_Path_FR_ExcelPath_Txt
Var hCtl_Office_Path_FR_ExcelPath_Btn
Var hCtl_Office_Path_FR_WordPath_Txt
Var hCtl_Office_Path_FR_WordPath_Btn
I am using a Function in my file to try to get the data:
Quote:
Function fnc_Office_PathData_Show
!insertmacro NSD_GetUserData $hCtl_Office_Path_FR_ExcelPath_Txt $ExcelEXEPath
!insertmacro NSD_GetUserData $hCtl_Office_Path_FR_WordPath_Txt $WordEXEPath
MessageBox MB_OK "Excel = $ExcelEXEPath; Word = $WordEXEPath"
FunctionEnd
To support this I took the code off of a webpage and placed it in NSD_GetUserData.nsh file (which I !included in my file with the function)
Quote:
!macro NSD_SetUserData hwnd data
nsDialogs::SetUserData ${hwnd} ${data}
!macroend
!define NSD_SetUserData `!insertmacro NSD_SetUserData`

!macro NSD_GetUserData hwnd outvar
nsDialogs::GetUserData ${hwnd}
Pop ${outvar}
!macroend
!define NSD_GetUserData `!insertmacro NSD_GetUserData`
coderwolf is offline   Reply With Quote
Old 27th February 2015, 10:02   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Use the NSD_GetText macro to read text from a edit field. GetUserData only has data if you add something there yourself with SetUserData.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump