Skip to content
⌘ NSIS Forum Archive

NSD_OnChange

4 posts

marcellokera#

NSD_OnChange

Knowing that NSD_OnChange macro receives two parameters (handle and function that will be called), is there a way to the called function receive another parameter besides the handle? I want to make the function settext.onChange generic and everytime I update a textbox a variable gets fill. I don't know if my question is clear but I researched on old foruns post and I saw that this was not possible (I saw a post from 2001 I think). SO is the best solution create a function for eache textbox? or there is a way to make it generic?

###
${NSD_CreateText} 90u 50 50% 10% $smtpHost
Pop $smtphwnd
${NSD_OnChange} $smtphwnd settext.onChange

${NSD_CreateText} 90u 50 50% 10% $from
Pop $fromhwnd
${NSD_OnChange} $smtphwnd settext.onChange

###


Function settext.onChange
${NSD_GetText} $R8 $R9
FunctionEnd
Animaether#
You've already got what you need to distinguish them by using the handle, though?

Function settext.onChange
  Pop $hwnd
  ${NSD_GetText} $hwnd $R8
  ${Select} $hwnd
  ${Case} $smtphwnd
    MessageBox MB_OK "From smtphwnd: $R8"
  ${Case} $fromhwnd
    MessageBox MB_OK "From fromhwnd: $R8"
  ${EndSelect}
FunctionEnd 
What sort of information were you hoping to pass along? The *UserData bits might also be of help;
marcellokera#
Humm that way might help. I was trying to do a very generic function by pushing the variable names and set them dinamicly, but I thing the way you show is just fine thanks.
Animaether#
can't really 'push variable names'.. what would you pop them to? 🙂 Can only push/pop values, really. If there were a GetVariableAddress.. then that might be possible.