!include LogicLib.nsh
!include nsDialogs.nsh
Name nsDialogs
OutFile nsDialogs.exe
XPStyle on
Page custom nsDialogsPage nsDialogsPageLeave
Page license
Page instfiles
Var Dialog
Var Label
Var Text
Var Text_State
Var Checkbox
Var Checkbox_State
Function .onInit
StrCpy $Text_State "Type something here2..."
FunctionEnd
Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $Label
${NSD_CreateText} 0 13u 100% 12u $Text_State
Pop $Text
${NSD_OnChange} $Text nsDialogsPageTextChange
${NSD_CreateCheckbox} 0 30u 100% 10u "&Something"
Pop $Checkbox
${If} $Checkbox_State == ${BST_CHECKED}
${NSD_Check} $Checkbox
${EndIf}
# alternative for the above ${If}:
#${NSD_SetState} $Checkbox_State
nsDialogs::Show
FunctionEnd
Function nsDialogsPageTextChange
Pop $1 # $1 == $ Text
${NSD_GetText} $Text $0
${If} $0 == "hello"
MessageBox MB_OK "right back at ya!"
${EndIf}
FunctionEnd
Function nsDialogsPageLeave
${NSD_GetText} $Text $Text_State
MessageBox MB_OK "You typed:$\n$\n$Text_State"
${NSD_GetState} $Checkbox $Checkbox_State
FunctionEnd
Section
; DetailPrint "hello world"
SectionEnd