Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. nsd combo callback bug workaround
  3. ---------------------------------
  4. A normal combobox onchange callback fails if you do:
  5. 1) Select item from dropdown
  6. 2) Append something to the string
  7. Maybe nsdialogs needs to use CBN_EDITCHANGE and not CBN_EDITUPDATE?
  8. */
  9. !include nsDialogs.nsh
  10. var myCombo
  11. function oncbchange
  12. pop $0
  13. ${If} $0 = 0
  14.     GetFunctionAddress $0 ${__FUNCTION__}
  15.     nsDialogs::KillTimer $0
  16.     pop $0
  17.     ;in a bug free NSD world, this would be the real handler:
  18.     ${If} $0 = $myCombo
  19.         ${NSD_GetText} $0 $1
  20.         MessageBox mb_ok combotext=$1
  21.     ${EndIf}
  22. ${Else}
  23.     ${If} $0 = $myCombo
  24.     ;${OrIf} $0 = $myCombo2 etc...
  25.         push $0
  26.         push 0
  27.         GetFunctionAddress $0 ${__FUNCTION__}
  28.         nsDialogs::CreateTimer $0 1
  29.     ${EndIf}
  30. ${EndIf}
  31. functionend
  32.  
  33. function nsdPage
  34. nsDialogs::Create 1018
  35. Pop $0
  36. ${NSD_CreateComboBox} 0 13u 100% -13u "hello"
  37. Pop $myCombo
  38. ${NSD_CB_AddString} $myCombo foo
  39. ${NSD_CB_AddString} $myCombo bar
  40. ${NSD_OnChange} $myCombo oncbchange
  41. nsDialogs::Show
  42. functionend
  43. page custom nsdPage
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement