Archive: Saving User Data on back


Saving User Data on back
Hi,
I am wondering if anyone knows how I could set the values of text fields when the user presses the back button..
something like this:


Function OnChange
Pop $0 ; HWND
System::Call user32::GetWindowText(i$Text_ccip,t.r0,i${NSIS_MAX_STRLEN})
Strcpy $CCIP $0
FunctionEnd

; on the bottom of my verification page i have the
; following code just before the end of the custom page
; function

; GetFunctionAddress $clnow clearnow
; nsDialogs::OnBack /NOUNLOAD $clnow
; nsDialogs::Show /NOUNLOAD
;FunctionEnd

Function clearnow
nsDialogs::SetUserData /NOUNLOAD $Text_ccip $CCIP
${NSD_SetText} $Text_ccip $CCIP
Strcpy $Text_ccip $CCIP

FunctionEnd



I am saving value entererd in the above text box into $CCIP.
when the user presses the back button the text fields (here text_ccip gets cleared. I want the user entered data to remain in the text box on pressing the back button. how could I use either the above or NSD_getstate? Any suggestions?

this is taken from the Memory section of the nsDialogs section of the manual and modified with your vars (I think)
anyways it compiles fine and does save the text in the text box when they click back


!include nsDialogs.nsh
!include LogicLib.nsh

Name "nsDialogs Example"
OutFile "nsDialogs Example.exe"


Var Text_ccip
Var Text_ccip_State

Page custom nsDialogsPage nsDialogsPageLeave
Page directory ;--need a page to go back from


Function nsDialogsPage

nsDialogs::Create /NOUNLOAD 1018
Pop $0

${NSD_CreateText} 10u 60u -20u 13u $Text_ccip_State
Pop $Text_ccip


nsDialogs::Show

FunctionEnd


Function nsDialogsPageLeave

${NSD_GetText} $Text_ccip $Text_ccip_State


FunctionEnd


Section
;blank section
SectionEnd

Hi, thx for your reply..
I tried the above code but it did not work..
Have attached the script i wrote...
it's a messy script so i apologize for the aesthetics/logic.

Suggestions are welcome.

Thanks


Solved
Solved:

I was calling nsdialogs:: onback unecessarily in the script. @ZmAn3: your code works.
Thanks.

Faheem