AngelSL Posted June 4, 2007 Posted June 4, 2007 So, another newbie question here. #include <GUIConstants.au3> #include <Misc.au3> $dll = DllOpen("user32.dll") $Form1 = GUICreate("Jumping Jacks", 401, 101, 193, 115) $Progress1 = GUICtrlCreateProgress(8, 8, 385, 33) ; GUICtrlSetData(-1, 0) $Button1 = GUICtrlCreateButton("+1", 16, 56, 97, 33) $msg = "Done: " & GUICtrlRead($Progress1) $Label1 = GUICtrlCreateLabel($msg, 120, 56, 269, 30) GUICtrlSetFont(-1, 20, 400, 0, "Adobe Garamond Pro") GUISetState(@SW_SHOW) $progresscore = GUICtrlRead($Progress1)+1 $Msg = GUIGetMsg() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If $Msg = $Button1 Then ;_IsPressed(09, $dll) Then GUICtrlSetData($Progress1, GUICtrlRead($Progress1)+1) EndIf WEnd I want to make it such that when the button is clicked, the progress bar's progress is increased by one, but that doesn't work. It seems the button just doesn't trigger.
thetwistedpanda Posted June 4, 2007 Posted June 4, 2007 So, another newbie question here. #include <GUIConstants.au3> #include <Misc.au3> $dll = DllOpen("user32.dll") $Form1 = GUICreate("Jumping Jacks", 401, 101, 193, 115) $Progress1 = GUICtrlCreateProgress(8, 8, 385, 33) ; GUICtrlSetData(-1, 0) $Button1 = GUICtrlCreateButton("+1", 16, 56, 97, 33) $msg = "Done: " & GUICtrlRead($Progress1) $Label1 = GUICtrlCreateLabel($msg, 120, 56, 269, 30) GUICtrlSetFont(-1, 20, 400, 0, "Adobe Garamond Pro") GUISetState(@SW_SHOW) $progresscore = GUICtrlRead($Progress1)+1 $Msg = GUIGetMsg() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If $Msg = $Button1 Then ;_IsPressed(09, $dll) Then GUICtrlSetData($Progress1, GUICtrlRead($Progress1)+1) EndIf WEnd I want to make it such that when the button is clicked, the progress bar's progress is increased by one, but that doesn't work. It seems the button just doesn't trigger. Hmm. You use $nMsg for the GUIGetMsg(), yet you use $Msg for the If statement... Oops?
GaryFrost Posted June 4, 2007 Posted June 4, 2007 Thanks alot! I wonder how I missed that... Just use it the switch case and you don't need to worry about that, for example: #include <GUIConstants.au3> #include <Misc.au3> $dll = DllOpen("user32.dll") $Form1 = GUICreate("Jumping Jacks", 401, 101, 193, 115) $Progress1 = GUICtrlCreateProgress(8, 8, 385, 33) ; GUICtrlSetData(-1, 0) $Button1 = GUICtrlCreateButton("+1", 16, 56, 97, 33) $msg = "Done: " & GUICtrlRead($Progress1) $Label1 = GUICtrlCreateLabel($msg, 120, 56, 269, 30) GUICtrlSetFont(-1, 20, 400, 0, "Adobe Garamond Pro") GUISetState(@SW_SHOW) $progresscore = GUICtrlRead($Progress1)+1 $Msg = GUIGetMsg() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlSetData($Progress1, GUICtrlRead($Progress1)+1) EndSwitch WEnd SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now