home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Programming / nsis-2.46-setup.exe / Examples / nsDialogs / example.nsi next >
Encoding:
Text File  |  2008-12-12  |  1.3 KB  |  83 lines

  1. !include nsDialogs.nsh
  2. !include LogicLib.nsh
  3.  
  4. Name "nsDialogs Example"
  5. OutFile "nsDialogs Example.exe"
  6.  
  7. XPStyle on
  8.  
  9. Page license
  10. Page custom nsDialogsPage
  11.  
  12. Var BUTTON
  13. Var EDIT
  14. Var CHECKBOX
  15.  
  16. Function nsDialogsPage
  17.  
  18.     nsDialogs::Create 1018
  19.     Pop $0
  20.  
  21.     GetFunctionAddress $0 OnBack
  22.     nsDialogs::OnBack $0
  23.  
  24.     ${NSD_CreateButton} 0 0 100% 12u Test
  25.     Pop $BUTTON
  26.     GetFunctionAddress $0 OnClick
  27.     nsDialogs::OnClick $BUTTON $0
  28.  
  29.     ${NSD_CreateText} 0 35 100% 12u hello
  30.     Pop $EDIT
  31.     GetFunctionAddress $0 OnChange
  32.     nsDialogs::OnChange $EDIT $0
  33.  
  34.     ${NSD_CreateCheckbox} 0 -50 100% 8u Test
  35.     Pop $CHECKBOX
  36.     GetFunctionAddress $0 OnCheckbox
  37.     nsDialogs::OnClick $CHECKBOX $0
  38.  
  39.     ${NSD_CreateLabel} 0 40u 75% 40u "* Type `hello there` above.$\n* Click the button.$\n* Check the checkbox.$\n* Hit the Back button."
  40.     Pop $0
  41.  
  42.     nsDialogs::Show
  43.  
  44. FunctionEnd
  45.  
  46. Function OnClick
  47.  
  48.     Pop $0 # HWND
  49.  
  50.     MessageBox MB_OK clicky
  51.  
  52. FunctionEnd
  53.  
  54. Function OnChange
  55.  
  56.     Pop $0 # HWND
  57.  
  58.     System::Call user32::GetWindowText(i$EDIT,t.r0,i${NSIS_MAX_STRLEN})
  59.  
  60.     ${If} $0 == "hello there"
  61.         MessageBox MB_OK "right back at ya"
  62.     ${EndIf}
  63.  
  64. FunctionEnd
  65.  
  66. Function OnBack
  67.  
  68.     MessageBox MB_YESNO "are you sure?" IDYES +2
  69.     Abort
  70.  
  71. FunctionEnd
  72.  
  73. Function OnCheckbox
  74.  
  75.     Pop $0 # HWND
  76.  
  77.     MessageBox MB_OK "checkbox clicked"
  78.  
  79. FunctionEnd
  80.  
  81. Section
  82. SectionEnd
  83.