Skip to content
⌘ NSIS Forum Archive

Invalid command: ${NSD_SetUserData}

3 posts

pld32#edited

Invalid command: ${NSD_SetUserData}

I'm trying a NSdialog example and getting an error? Can anyone tell me what is missing?

Invalid command: ${NSD_SetUserData}

I'm using HM NIS Edit 2.0.3

MakeNSIS V2.46

!include "nsDialogs.nsh"
!include "winmessages.nsh"
!include "logiclib.nsh"

OutFile "test.exe"

Page Custom pre post

var dialog
var hwnd
var minor

Function pre
nsDialogs::Create 1018
Pop $dialog

${NSD_CreateRadioButton} 0 0 40% 6% "I am 14 years of age or older"
Pop $hwnd
${NSD_AddStyle} $hwnd ${WS_GROUP}
${NSD_SetUserData} $hwnd "false"
${NSD_OnClick} $hwnd RadioClick
${NSD_CreateRadioButton} 0 12% 40% 6% "I am younger than 14 of age"
Pop $hwnd
${NSD_SetUserData} $hwnd "true"
${NSD_OnClick} $hwnd RadioClick

nsDialogs::Show
FunctionEnd

Function RadioClick
Pop $hwnd
${NSD_GetUserData} $hwnd $minor
FunctionEnd

Function post
${If} $minor == ""
MessageBox MB_OK "Please specify your age group"
Abort
${ElseIf} $minor == true
MessageBox MB_OK "installation will continue with content appropriate for your age"
${Else}
MessageBox MB_OK "installation will continue normally"
${EndIf}
FunctionEnd

Section ""
SectionEnd