checkbox FOCUS & DISABLE

11/09/2009 08:15 pzyhô#1
Hy, wie bekomm ich das hin das wenn die checkbox unchecked is der button nicht anklickbar ist und wenn sie checked is der button anklickbar is... ich weis komisch formuliert. So habs ich getestet aber wenn ich dann Checkbox anklicke bleibt der button trotzdem "unchecked" was mach ich da falsch ?


Code:
$Checkbox1 = 0
test()


Func test()
If $Checkbox1 = 0 Then
	$Button1 = GUICtrlSetState(-1, $GUI_DISABLE)
EndIf
EndFunc

IF $Checkbox1 = 1 Then
	$Button1 = GUICtrlSetState(-1, $GUI_FOCUS)
EndIf
wenn mir einer sagen kann wie ich das mach das des klappt gibts thx ;)
11/09/2009 18:04 | Moep |#2
Code:
#include <GUIConstantsEx.au3>
GUICreate("") 
$check = GUICtrlCreateCheckbox("Checkbox", 10, 10, 120, 20)
$button = GUICtrlCreateButton("Button",10,50)
GUICtrlSetState($button,$GUI_DISABLE)
GUISetState() 
While 1
	$msg = GUIGetMsg()
	$read = GUICtrlRead($check)
	If $msg = $GUI_EVENT_CLOSE Then ExitLoop
	If $msg = $check And $read = $GUI_CHECKED Then
		GUICtrlSetState($button,$GUI_ENABLE)
	ElseIf $msg = $check And $read = $GUI_UNCHECKED Then
		GUICtrlSetState($button,$GUI_DISABLE)
	EndIf
WEnd