name22

RadioButton WM_COMMAND

Aug 21st, 2013
117
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <GUIConstants.au3>
  2. #include <WindowsConstants.au3>
  3.  
  4. $hWnd = GUICreate("Test", 400, 200)
  5. $cRadio_On = GUICtrlCreateRadio("On", 15, 5, 60, 20)
  6. $cRadio_Off = GUICtrlCreateRadio("Off", 15, 30, 60, 20)
  7. $cInput = GUICtrlCreateInput("", 15, 60, 200, 25)
  8. GUISetState()
  9.  
  10. Global $bInputState = 1
  11.  
  12. GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")
  13.  
  14. While True
  15.     Switch GUIGetMsg()
  16.         Case $GUI_EVENT_CLOSE
  17.             Exit
  18.     EndSwitch
  19. WEnd
  20.  
  21. Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
  22.     Switch $wParam
  23.         Case $cRadio_On
  24.             If Not $bInputState Then
  25.                 GUICtrlSetState($cInput, $GUI_ENABLE)
  26.                 $bInputState = 1
  27.             EndIf
  28.         Case $cRadio_Off
  29.             If $bInputState Then
  30.                 GUICtrlSetState($cInput, $GUI_DISABLE)
  31.                 $bInputState = 0
  32.             EndIf
  33.     EndSwitch
  34. EndFunc
RAW Paste Data