Bert Posted December 16, 2005 Share Posted December 16, 2005 I have a timer program that has 2 problems: 1. I need to add more timers, so I wanted to have the box have a scroll bar. The box won't scroll. ????? 2. If you start a timer, let it run for a couple of seconds, stop it, THEN RESTART IT WITHOUT RESETTING IT, the stop button will not work for that timer. expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> AutoItSetOption ("TrayIconDebug", 1) Dim $Header_1 = " Ticket" Dim $Name, $TotalTime, $Unit, $count = 8;20 Dim $TimerActive_[50], $Label_[50], $TButton_[50], $SButton_[50], $Input_[50], $Label_[50] Dim $Time_[50], $Timer_[50], $sTime_[50], $xk, $ck, $Left = 0, $Top = 20, $X Dim $Input1_[50], $Input2_[50] AdlibEnable("AllTimers", 500) GUICreate(" T(egg) Timer", 895, 895,-1 ,-1 ,$WS_MAXIMIZEBOX + $WS_MINIMIZEBOX + $WS_VSCROLL,); )$WS_SYSMENU GUICtrlSetState(-1,$GUI_DISABLE) GUICtrlSetCursor(-1, 0) ;label GUICtrlCreateLabel($Header_1 & "s", -25, 0, 895, 20, $SS_CENTER, $WS_EX_STATICEDGE) GUICtrlSetFont(-1, 12, 700) GUICtrlSetBkColor(-1, 0x00ff00) GUICtrlCreateLabel("This tool is NOT to be used for tracking of LOS or warning of SLA.", 205, 730, 130,40,$SS_CENTER) $iniTI = iniread("timer.ini", "message", "on", "") $act1 = GUICtrlCreateCheckbox("Message popup active",10, 715) IF $iniTI == "1" then GUICtrlSetState($act1, $GUI_CHECKED) IF $iniTI == "4" then GUICtrlSetState($act1, $GUI_UNCHECKED) $buttonTI = GUICtrlCreateButton ("&Save Settings", 10, 740, 80) $buttonTI2 = GUICtrlCreateButton ("&How to use T(egg) Timer", 400, 740, 130) For $X = 1 To 8 ; row 1 GUICtrlCreateLabel($Header_1 & "" & $X, $Left, $Top, 80, 20, $SS_CENTER) $Label_[$X] = GUICtrlCreateLabel("", $Left, $Top + 20, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X], 16) GUICtrlSetData($Label_[$X], "00:00:00") $TButton_[$X] = GUICtrlCreateButton("Start", $Left, $Top + 50, 50, 20) $SButton_[$X] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 50, 50, 20) $Input_[$X] = GUICtrlCreateInput("", $Left, $Top + 70, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 93, 100, 20, 0x1000) ; row 2 GUICtrlCreateLabel($Header_1 & "" & $X + 8, $Left, $Top + 125, 80, 20, $SS_CENTER) $Label_[$X + 8] = GUICtrlCreateLabel("", $Left, $Top + 145, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 125, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 8], 16) GUICtrlSetData($Label_[$X + 8], "00:00:00") $TButton_[$X + 8] = GUICtrlCreateButton("Start", $Left, $Top + 175, 50, 20) $SButton_[$X + 8] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 175, 50, 20) $Input_[$X + 8] = GUICtrlCreateInput("", $Left, $Top + 195, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 218, 100, 20, 0x1000) ; row 3 GUICtrlCreateLabel($Header_1 & "" & $X + 16, $Left, $Top + 250, 80, 20, $SS_CENTER) $Label_[$X + 16] = GUICtrlCreateLabel("", $Left, $Top + 270, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 250, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 16], 16) GUICtrlSetData($Label_[$X + 16], "00:00:00") $TButton_[$X + 16] = GUICtrlCreateButton("Start", $Left, $Top + 300, 50, 20) $SButton_[$X + 16] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 300, 50, 20) $Input_[$X + 16] = GUICtrlCreateInput("", $Left, $Top + 320, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 343, 100, 20, 0x1000) ; ;; row 4 GUICtrlCreateLabel($Header_1 & "" & $X + 24, $Left, $Top + 375, 80, 20, $SS_CENTER) $Label_[$X + 24] = GUICtrlCreateLabel("", $Left, $Top + 395, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 375, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 24], 16) GUICtrlSetData($Label_[$X + 24], "00:00:00") $TButton_[$X + 24] = GUICtrlCreateButton("Start", $Left, $Top + 425, 50, 20) $SButton_[$X + 24] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 425, 50, 20) $Input_[$X + 24] = GUICtrlCreateInput("", $Left, $Top + 445, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 468, 100, 20, 0x1000) $Left = $Left + 110 Next GUISetState() While 1 $msg = GUIGetMsg() For $xk = 1 To $count If $msg = $TButton_[$xk] And GUICtrlRead($Input_[$xk]) > "" Then GUICtrlSetState($TButton_[$xk], $GUI_DISABLE) GUICtrlSetState($Input_[$xk], $GUI_DISABLE) $TimerActive_[$xk] = 1 $Timer_[$xk] = TimerInit() ElseIf $msg = $TButton_[$xk] Then MsgBox(64, "User Error", "Please Type in a Ticket Number ", 3) EndIf If $msg = $SButton_[$xk] And GUICtrlRead($SButton_[$xk]) = "Reset" Then GUICtrlSetData($Label_[$xk], "00:00:00") GUICtrlSetData($Input_[$xk], "") GUICtrlSetData($SButton_[$xk], "Stop") EndIf If $msg = $SButton_[$xk] And GUICtrlRead($Input_[$xk]) > "" And GUICtrlRead($SButton_[$xk]) = "Stop" Then $TimerActive_[$xk] = 0 GUICtrlSetData($SButton_[$xk], "Reset") GUICtrlSetState($TButton_[$xk], $GUI_ENABLE) GUICtrlSetState($Input_[$xk], $GUI_ENABLE) ; GUICtrlSetBkColor($Label_[$xk], 0xD4D0C8) $Name = GUICtrlRead($Input_[$xk]) ; If $xk < 5 Then $Unit = $Header_1 & " " & $xk EndIf EndIf If $xk = 5 Then ExitLoop Next If $msg = $GUI_EVENT_CLOSE Then ExitLoop IF $msg = $buttonTI then $check = GUICtrlRead($act1) ; msgbox( 0, "", $check) ; for testing If $check == 4 then iniwrite ("timer.ini", "message", "on", "4") If $check == 1 then iniwrite ("timer.ini", "message", "on", "1") endif WEnd Func AllTimers() Local $Secs, $Mins, $Hour For $ck = 1 To $count If $TimerActive_[$ck] Then _TicksToTime(Int(TimerDiff($Timer_[$ck])), $Hour, $Mins, $Secs) $Time_[$ck] = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) If $sTime_[$ck] <> $Time_[$ck] Then GUICtrlSetData($Label_[$ck], $Time_[$ck]) If $Mins == 0 and $Secs == 05 Then GUICtrlSetBkColor($Label_[$ck], 0x00FF00 ) msgbox(0, "1 hour", "1 hour") endif If $Mins == 0 and $Secs == 10 Then GUICtrlSetBkColor($Label_[$ck], 0xF9F900) msgbox(0, "2 hour", "2 hour") endif If $Mins == 0 and $Secs == 15 Then GUICtrlSetBkColor($Label_[$ck], 0xFF4242) msgbox(0, "3 hour", "3 hour") endif EndIf Next EndFunc ;==>AllTimers The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
seandisanti Posted December 16, 2005 Share Posted December 16, 2005 I have a timer program that has 2 problems: 1. I need to add more timers, so I wanted to have the box have a scroll bar. The box won't scroll. ????? 2. If you start a timer, let it run for a couple of seconds, stop it, THEN RESTART IT WITHOUT RESETTING IT, the stop button will not work for that timer.1. i changed line 13 to use a BitOr() to combine the styles 2. added a check to your $Timer_[$xk] = TimerInit() so that it only resets the timer if there isn't one running already. this way though, when you restart, it keeps going from the original timer. if that's what you want, cool, if not, create a variable that holds a TimerInit() when stop is pressed, then add an else to the line i modified so that if there is already a time, it will revert to the timestamp from the stop button, rather than the original. *** also. a few bugs i noticed but didn't address: 1. if you start, then stop, then restart, you can't stop the timer... 2. after 5 seconds you get a msgbox saying 1 hour? 10 seconds = 2 hours? expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> AutoItSetOption ("TrayIconDebug", 1) Dim $Header_1 = " Ticket" Dim $Name, $TotalTime, $Unit, $count = 8;20 Dim $TimerActive_[50], $Label_[50], $TButton_[50], $SButton_[50], $Input_[50], $Label_[50] Dim $Time_[50], $Timer_[50], $sTime_[50], $xk, $ck, $Left = 0, $Top = 20, $X Dim $Input1_[50], $Input2_[50] AdlibEnable("AllTimers", 500) GUICreate(" T(egg) Timer", 895, 895,-1 ,-1 ,BitOR($WS_MAXIMIZEBOX , $WS_MINIMIZEBOX , $WS_VSCROLL)); )$WS_SYSMENU GUICtrlSetState(-1,$GUI_DISABLE) GUICtrlSetCursor(-1, 0) ;label GUICtrlCreateLabel($Header_1 & "s", -25, 0, 895, 20, $SS_CENTER, $WS_EX_STATICEDGE) GUICtrlSetFont(-1, 12, 700) GUICtrlSetBkColor(-1, 0x00ff00) GUICtrlCreateLabel("This tool is NOT to be used for tracking of LOS or warning of SLA.", 205, 730, 130,40,$SS_CENTER) $iniTI = iniread("timer.ini", "message", "on", "") $act1 = GUICtrlCreateCheckbox("Message popup active",10, 715) IF $iniTI == "1" then GUICtrlSetState($act1, $GUI_CHECKED) IF $iniTI == "4" then GUICtrlSetState($act1, $GUI_UNCHECKED) $buttonTI = GUICtrlCreateButton ("&Save Settings", 10, 740, 80) $buttonTI2 = GUICtrlCreateButton ("&How to use T(egg) Timer", 400, 740, 130) For $X = 1 To 8 ; row 1 GUICtrlCreateLabel($Header_1 & "" & $X, $Left, $Top, 80, 20, $SS_CENTER) $Label_[$X] = GUICtrlCreateLabel("", $Left, $Top + 20, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X], 16) GUICtrlSetData($Label_[$X], "00:00:00") $TButton_[$X] = GUICtrlCreateButton("Start", $Left, $Top + 50, 50, 20) $SButton_[$X] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 50, 50, 20) $Input_[$X] = GUICtrlCreateInput("", $Left, $Top + 70, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 93, 100, 20, 0x1000) ; row 2 GUICtrlCreateLabel($Header_1 & "" & $X + 8, $Left, $Top + 125, 80, 20, $SS_CENTER) $Label_[$X + 8] = GUICtrlCreateLabel("", $Left, $Top + 145, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 125, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 8], 16) GUICtrlSetData($Label_[$X + 8], "00:00:00") $TButton_[$X + 8] = GUICtrlCreateButton("Start", $Left, $Top + 175, 50, 20) $SButton_[$X + 8] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 175, 50, 20) $Input_[$X + 8] = GUICtrlCreateInput("", $Left, $Top + 195, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 218, 100, 20, 0x1000) ; row 3 GUICtrlCreateLabel($Header_1 & "" & $X + 16, $Left, $Top + 250, 80, 20, $SS_CENTER) $Label_[$X + 16] = GUICtrlCreateLabel("", $Left, $Top + 270, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 250, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 16], 16) GUICtrlSetData($Label_[$X + 16], "00:00:00") $TButton_[$X + 16] = GUICtrlCreateButton("Start", $Left, $Top + 300, 50, 20) $SButton_[$X + 16] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 300, 50, 20) $Input_[$X + 16] = GUICtrlCreateInput("", $Left, $Top + 320, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 343, 100, 20, 0x1000) ; ;; row 4 GUICtrlCreateLabel($Header_1 & "" & $X + 24, $Left, $Top + 375, 80, 20, $SS_CENTER) $Label_[$X + 24] = GUICtrlCreateLabel("", $Left, $Top + 395, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 375, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 24], 16) GUICtrlSetData($Label_[$X + 24], "00:00:00") $TButton_[$X + 24] = GUICtrlCreateButton("Start", $Left, $Top + 425, 50, 20) $SButton_[$X + 24] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 425, 50, 20) $Input_[$X + 24] = GUICtrlCreateInput("", $Left, $Top + 445, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 468, 100, 20, 0x1000) $Left = $Left + 110 Next GUISetState() While 1 $msg = GUIGetMsg() For $xk = 1 To $count If $msg = $TButton_[$xk] And GUICtrlRead($Input_[$xk]) > "" Then GUICtrlSetState($TButton_[$xk], $GUI_DISABLE) GUICtrlSetState($Input_[$xk], $GUI_DISABLE) $TimerActive_[$xk] = 1 If Not StringLen(String($Timer_[$xk])) Then $Timer_[$xk] = TimerInit() ElseIf $msg = $TButton_[$xk] Then MsgBox(64, "User Error", "Please Type in a Ticket Number ", 3) EndIf If $msg = $SButton_[$xk] And GUICtrlRead($SButton_[$xk]) = "Reset" Then GUICtrlSetData($Label_[$xk], "00:00:00") GUICtrlSetData($Input_[$xk], "") GUICtrlSetData($SButton_[$xk], "Stop") EndIf If $msg = $SButton_[$xk] And GUICtrlRead($Input_[$xk]) > "" And GUICtrlRead($SButton_[$xk]) = "Stop" Then $TimerActive_[$xk] = 0 GUICtrlSetData($SButton_[$xk], "Reset") GUICtrlSetState($TButton_[$xk], $GUI_ENABLE) GUICtrlSetState($Input_[$xk], $GUI_ENABLE) ; GUICtrlSetBkColor($Label_[$xk], 0xD4D0C8) $Name = GUICtrlRead($Input_[$xk]) ; If $xk < 5 Then $Unit = $Header_1 & " " & $xk EndIf EndIf If $xk = 5 Then ExitLoop Next If $msg = $GUI_EVENT_CLOSE Then ExitLoop IF $msg = $buttonTI then $check = GUICtrlRead($act1) ; msgbox( 0, "", $check); for testing If $check == 4 then iniwrite ("timer.ini", "message", "on", "4") If $check == 1 then iniwrite ("timer.ini", "message", "on", "1") endif WEnd Func AllTimers() Local $Secs, $Mins, $Hour For $ck = 1 To $count If $TimerActive_[$ck] Then _TicksToTime(Int(TimerDiff($Timer_[$ck])), $Hour, $Mins, $Secs) $Time_[$ck] = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) If $sTime_[$ck] <> $Time_[$ck] Then GUICtrlSetData($Label_[$ck], $Time_[$ck]) If $Mins == 0 and $Secs == 05 Then GUICtrlSetBkColor($Label_[$ck], 0x00FF00 ) msgbox(0, "1 hour", "1 hour") endif If $Mins == 0 and $Secs == 10 Then GUICtrlSetBkColor($Label_[$ck], 0xF9F900) msgbox(0, "2 hour", "2 hour") endif If $Mins == 0 and $Secs == 15 Then GUICtrlSetBkColor($Label_[$ck], 0xFF4242) msgbox(0, "3 hour", "3 hour") endif EndIf Next EndFunc;==>AllTimers Link to comment Share on other sites More sharing options...
Bert Posted December 16, 2005 Author Share Posted December 16, 2005 (edited) I tried your code fix. I still have the same 2 problems. The GUI won't scroll, and the start, stop, restart breaks the stop button. Edited December 16, 2005 by vollyman The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted December 16, 2005 Author Share Posted December 16, 2005 I'm wondering, do I need to put in a window inside the GUI for the scroll to work? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
seandisanti Posted December 16, 2005 Share Posted December 16, 2005 I tried your code fix. I still have the same 2 problems. The GUI won't scroll, and the start, stop, restart breaks the stop button.i'll re-examine the code and work on the re-stopping after a re-start. did you make any changes to the code (like adding the $tmp = TimerInit() to the stop button?) Link to comment Share on other sites More sharing options...
Bert Posted December 16, 2005 Author Share Posted December 16, 2005 The only thing I did was change the size of the GUI GUICreate(" T(egg) Timer", 895, 495,-1 ,-1 ,BitOR($WS_MAXIMIZEBOX , $WS_MINIMIZEBOX , $WS_VSCROLL) The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
seandisanti Posted December 16, 2005 Share Posted December 16, 2005 The only thing I did was change the size of the GUI GUICreate(" T(egg) Timer", 895, 495,-1 ,-1 ,BitOR($WS_MAXIMIZEBOX , $WS_MINIMIZEBOX , $WS_VSCROLL)got it. added an else to the condition i'd added previously, so that if there is alreayd a timer, it resumes from the original timer and changes the reset button to say stop. also changed the condition on the stop button so that instead of checking the input for > "" it looks for <> "" expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> AutoItSetOption ("TrayIconDebug", 1) Dim $Header_1 = " Ticket" Dim $Name, $TotalTime, $Unit, $count = 8;20 Dim $TimerActive_[50], $Label_[50], $TButton_[50], $SButton_[50], $Input_[50], $Label_[50] Dim $Time_[50], $Timer_[50], $sTime_[50], $xk, $ck, $Left = 0, $Top = 20, $X Dim $Input1_[50], $Input2_[50] AdlibEnable("AllTimers", 500) GUICreate(" T(egg) Timer", 895, 495,-1 ,-1 ,BitOR($WS_MAXIMIZEBOX , $WS_MINIMIZEBOX , $WS_VSCROLL)) GUICtrlSetState(-1,$GUI_DISABLE) GUICtrlSetCursor(-1, 0) ;label GUICtrlCreateLabel($Header_1 & "s", -25, 0, 895, 20, $SS_CENTER, $WS_EX_STATICEDGE) GUICtrlSetFont(-1, 12, 700) GUICtrlSetBkColor(-1, 0x00ff00) GUICtrlCreateLabel("This tool is NOT to be used for tracking of LOS or warning of SLA.", 205, 730, 130,40,$SS_CENTER) $iniTI = iniread("timer.ini", "message", "on", "") $act1 = GUICtrlCreateCheckbox("Message popup active",10, 715) IF $iniTI == "1" then GUICtrlSetState($act1, $GUI_CHECKED) IF $iniTI == "4" then GUICtrlSetState($act1, $GUI_UNCHECKED) $buttonTI = GUICtrlCreateButton ("&Save Settings", 10, 740, 80) $buttonTI2 = GUICtrlCreateButton ("&How to use T(egg) Timer", 400, 740, 130) For $X = 1 To 8 ; row 1 GUICtrlCreateLabel($Header_1 & "" & $X, $Left, $Top, 80, 20, $SS_CENTER) $Label_[$X] = GUICtrlCreateLabel("", $Left, $Top + 20, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X], 16) GUICtrlSetData($Label_[$X], "00:00:00") $TButton_[$X] = GUICtrlCreateButton("Start", $Left, $Top + 50, 50, 20) $SButton_[$X] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 50, 50, 20) $Input_[$X] = GUICtrlCreateInput("", $Left, $Top + 70, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 93, 100, 20, 0x1000) ; row 2 GUICtrlCreateLabel($Header_1 & "" & $X + 8, $Left, $Top + 125, 80, 20, $SS_CENTER) $Label_[$X + 8] = GUICtrlCreateLabel("", $Left, $Top + 145, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 125, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 8], 16) GUICtrlSetData($Label_[$X + 8], "00:00:00") $TButton_[$X + 8] = GUICtrlCreateButton("Start", $Left, $Top + 175, 50, 20) $SButton_[$X + 8] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 175, 50, 20) $Input_[$X + 8] = GUICtrlCreateInput("", $Left, $Top + 195, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 218, 100, 20, 0x1000) ; row 3 GUICtrlCreateLabel($Header_1 & "" & $X + 16, $Left, $Top + 250, 80, 20, $SS_CENTER) $Label_[$X + 16] = GUICtrlCreateLabel("", $Left, $Top + 270, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 250, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 16], 16) GUICtrlSetData($Label_[$X + 16], "00:00:00") $TButton_[$X + 16] = GUICtrlCreateButton("Start", $Left, $Top + 300, 50, 20) $SButton_[$X + 16] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 300, 50, 20) $Input_[$X + 16] = GUICtrlCreateInput("", $Left, $Top + 320, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 343, 100, 20, 0x1000) ; ;; row 4 GUICtrlCreateLabel($Header_1 & "" & $X + 24, $Left, $Top + 375, 80, 20, $SS_CENTER) $Label_[$X + 24] = GUICtrlCreateLabel("", $Left, $Top + 395, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 375, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 24], 16) GUICtrlSetData($Label_[$X + 24], "00:00:00") $TButton_[$X + 24] = GUICtrlCreateButton("Start", $Left, $Top + 425, 50, 20) $SButton_[$X + 24] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 425, 50, 20) $Input_[$X + 24] = GUICtrlCreateInput("", $Left, $Top + 445, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 468, 100, 20, 0x1000) $Left = $Left + 110 Next GUISetState() While 1 $msg = GUIGetMsg() For $xk = 1 To $count If $msg = $TButton_[$xk] And GUICtrlRead($Input_[$xk]) > "" Then GUICtrlSetState($TButton_[$xk], $GUI_DISABLE) GUICtrlSetState($Input_[$xk], $GUI_DISABLE) $TimerActive_[$xk] = 1 If Not StringLen(String($Timer_[$xk])) Then $Timer_[$xk] = TimerInit() Else GUICtrlSetData($SButton_[$xk], "Stop") EndIf ElseIf $msg = $TButton_[$xk] Then MsgBox(64, "User Error", "Please Type in a Ticket Number ", 3) EndIf If $msg = $SButton_[$xk] And GUICtrlRead($SButton_[$xk]) = "Reset" Then GUICtrlSetData($Label_[$xk], "00:00:00") GUICtrlSetData($Input_[$xk], "") GUICtrlSetData($SButton_[$xk], "Stop") EndIf If $msg = $SButton_[$xk] And GUICtrlRead($Input_[$xk]) <> "" And GUICtrlRead($SButton_[$xk]) = "Stop" Then $TimerActive_[$xk] = 0 GUICtrlSetData($SButton_[$xk], "Reset") GUICtrlSetState($TButton_[$xk], $GUI_ENABLE) GUICtrlSetState($Input_[$xk], $GUI_ENABLE) ; GUICtrlSetBkColor($Label_[$xk], 0xD4D0C8) $Name = GUICtrlRead($Input_[$xk]) ; If $xk < 5 Then $Unit = $Header_1 & " " & $xk EndIf EndIf If $xk = 5 Then ExitLoop Next If $msg = $GUI_EVENT_CLOSE Then ExitLoop IF $msg = $buttonTI then $check = GUICtrlRead($act1) ; msgbox( 0, "", $check); for testing If $check == 4 then iniwrite ("timer.ini", "message", "on", "4") If $check == 1 then iniwrite ("timer.ini", "message", "on", "1") endif WEnd Func AllTimers() Local $Secs, $Mins, $Hour For $ck = 1 To $count If $TimerActive_[$ck] Then _TicksToTime(Int(TimerDiff($Timer_[$ck])), $Hour, $Mins, $Secs) $Time_[$ck] = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) If $sTime_[$ck] <> $Time_[$ck] Then GUICtrlSetData($Label_[$ck], $Time_[$ck]) If $Mins == 0 and $Secs == 05 Then GUICtrlSetBkColor($Label_[$ck], 0x00FF00 ) msgbox(0, "1 hour", "1 hour") endif If $Mins == 0 and $Secs == 10 Then GUICtrlSetBkColor($Label_[$ck], 0xF9F900) msgbox(0, "2 hour", "2 hour") endif If $Mins == 0 and $Secs == 15 Then GUICtrlSetBkColor($Label_[$ck], 0xFF4242) msgbox(0, "3 hour", "3 hour") endif EndIf Next EndFunc;==>AllTimers Link to comment Share on other sites More sharing options...
Bert Posted December 16, 2005 Author Share Posted December 16, 2005 Sweet. That fixed the start stop. Thanks! I'm still trying to figure out the scroll problem. The users I'm designing this for want about 120 timers. I figure the only way to do that is a scroll bar. I could do tabs, but the users rather have a scroll. Does a GUI work with a scroll, or do I need a GUICtrlCreateEdit with everything inside it? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
seandisanti Posted December 16, 2005 Share Posted December 16, 2005 Sweet. That fixed the start stop. Thanks! I'm still trying to figure out the scroll problem. The users I'm designing this for want about 120 timers. I figure the only way to do that is a scroll bar. I could do tabs, but the users rather have a scroll. Does a GUI work with a scroll, or do I need a GUICtrlCreateEdit with everything inside it?the last time i tried to use a scroll bar it's functionality had not be implemented yet , but that was months ago...you couldn't put the other controls into an edit control though could you? Do they really need to SEE all the timers?i mean couldn't you have 5 or 6 lined up horizontally, with combo boxes that let them choose which of the 120 they'd like displayed in that position? Link to comment Share on other sites More sharing options...
Bert Posted December 16, 2005 Author Share Posted December 16, 2005 I thought about that. I was thinking of using tabs, and showing 32 at a time. Also, have a extra tab with a options field. From what you are telling me, it isn't supported yet. Let me try going the tab route, and I'll post my code when I'm done. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted December 16, 2005 Author Share Posted December 16, 2005 Ok, tried doing the tab route, and I get a error "Array variable has incorrect number of subscripts or subscript dimention range exceeded". I have no idea what that means. here is the code expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> AutoItSetOption ("TrayIconDebug", 1) Dim $Header_1 = " Ticket" Dim $Name, $TotalTime, $Unit, $count = 40;20 Dim $TimerActive_[50], $Label_[50], $TButton_[50], $SButton_[50], $Input_[50], $Label_[50] Dim $Time_[50], $Timer_[50], $sTime_[50], $xk, $ck, $Left = 0, $Top = 20, $X Dim $Input1_[50], $Input2_[50] AdlibEnable("AllTimers", 500) GUICreate(" T(egg) Timer", 871, 540,-1 ,-1 );,BitOR($WS_MAXIMIZEBOX , $WS_MINIMIZEBOX , $WS_VSCROLL)) GUICtrlSetState(-1,$GUI_DISABLE) GUICtrlSetCursor(-1, 0) GUICtrlCreateTab (-1, -1, 895,540) GUICtrlCreateTabItem("Tickets 1-32") ;label GUICtrlCreateLabel($Header_1 & "s", -20, 23, 890, 18, $SS_CENTER, $WS_EX_STATICEDGE) GUICtrlSetFont(-1, 12, 700) GUICtrlSetBkColor(-1, 0x00ff00) GUICtrlCreateLabel("This tool is NOT to be used for tracking of LOS or warning of SLA.", 205, 730, 130,40,$SS_CENTER) $iniTI = iniread("timer.ini", "message", "on", "") $act1 = GUICtrlCreateCheckbox("Message popup active",10, 715) IF $iniTI == "1" then GUICtrlSetState($act1, $GUI_CHECKED) IF $iniTI == "4" then GUICtrlSetState($act1, $GUI_UNCHECKED) $buttonTI = GUICtrlCreateButton ("&Save Settings", 10, 740, 80) $buttonTI2 = GUICtrlCreateButton ("&How to use T(egg) Timer", 400, 740, 130) For $X = 1 To 8 ; row 1 GUICtrlCreateLabel($Header_1 & "" & $X, $Left, $Top + 25, 80, 20, $SS_CENTER); ticket lable ex: ticket 1 $Label_[$X] = GUICtrlCreateLabel("", $Left, $Top + 43, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 23, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X], 16) GUICtrlSetData($Label_[$X], "00:00:00") $TButton_[$X] = GUICtrlCreateButton("Start", $Left, $Top + 73, 50, 20) $SButton_[$X] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 73, 50, 20) $Input_[$X] = GUICtrlCreateInput("", $Left, $Top + 93, 100, 20,0x2000 + 0x1000 + 0x0002) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 116, 100, 20, 0x1000 + 0x0002) ; row 2 GUICtrlCreateLabel($Header_1 & "" & $X + 8, $Left, $Top + 150, 80, 20, $SS_CENTER) $Label_[$X + 8] = GUICtrlCreateLabel("", $Left, $Top + 170, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 150, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 8], 16) GUICtrlSetData($Label_[$X + 8], "00:00:00") $TButton_[$X + 8] = GUICtrlCreateButton("Start", $Left, $Top + 200, 50, 20) $SButton_[$X + 8] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 200, 50, 20) $Input_[$X + 8] = GUICtrlCreateInput("", $Left, $Top + 220, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 243, 100, 20, 0x1000) ; ;; row 3 GUICtrlCreateLabel($Header_1 & "" & $X + 16, $Left, $Top + 275, 80, 20, $SS_CENTER) $Label_[$X + 16] = GUICtrlCreateLabel("", $Left, $Top + 295, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 275, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 16], 16) GUICtrlSetData($Label_[$X + 16], "00:00:00") $TButton_[$X + 16] = GUICtrlCreateButton("Start", $Left, $Top + 325, 50, 20) $SButton_[$X + 16] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 325, 50, 20) $Input_[$X + 16] = GUICtrlCreateInput("", $Left, $Top + 345, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 368, 100, 20, 0x1000) ; ;; row 4 GUICtrlCreateLabel($Header_1 & "" & $X + 24, $Left, $Top + 400, 80, 20, $SS_CENTER) $Label_[$X + 24] = GUICtrlCreateLabel("", $Left, $Top + 420, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 400, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 24], 16) GUICtrlSetData($Label_[$X + 24], "00:00:00") $TButton_[$X + 24] = GUICtrlCreateButton("Start", $Left, $Top + 450, 50, 20) $SButton_[$X + 24] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 450, 50, 20) $Input_[$X + 24] = GUICtrlCreateInput("", $Left, $Top + 470, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 493, 100, 20, 0x1000) $Left = $Left + 110 Next GUISetState() ;second tab----------------------------------------------------------- For $X = 33 To 40 GUICtrlCreateTabItem("Tickets 33-64") ; row 1 GUICtrlCreateLabel($Header_1 & "" & $X + 32, $Left, $Top + 25, 80, 20, $SS_CENTER); ticket lable ex: ticket 1 $Label_[$X + 32] = GUICtrlCreateLabel("", $Left, $Top + 43, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 23, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 32], 16) GUICtrlSetData($Label_[$X + 32], "00:00:00") $TButton_[$X + 32] = GUICtrlCreateButton("Start", $Left, $Top + 73, 50, 20) $SButton_[$X + 32] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 73, 50, 20) $Input_[$X + 32] = GUICtrlCreateInput("", $Left, $Top + 93, 100, 20,0x2000 + 0x1000 + 0x0002) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 116, 100, 20, 0x1000 + 0x0002) $Left = $Left + 110 Next GUISetState() While 1 $msg = GUIGetMsg() For $xk = 1 To $count If $msg = $TButton_[$xk] And GUICtrlRead($Input_[$xk]) > "" Then GUICtrlSetState($TButton_[$xk], $GUI_DISABLE) GUICtrlSetState($Input_[$xk], $GUI_DISABLE) $TimerActive_[$xk] = 1 If Not StringLen(String($Timer_[$xk])) Then $Timer_[$xk] = TimerInit() Else GUICtrlSetData($SButton_[$xk], "Stop") EndIf ElseIf $msg = $TButton_[$xk] Then MsgBox(64, "User Error", "Please Type in a Ticket Number ", 3) EndIf If $msg = $SButton_[$xk] And GUICtrlRead($SButton_[$xk]) = "Reset" Then GUICtrlSetData($Label_[$xk], "00:00:00") GUICtrlSetData($Input_[$xk], "") GUICtrlSetData($SButton_[$xk], "Stop") EndIf If $msg = $SButton_[$xk] And GUICtrlRead($Input_[$xk]) <> "" And GUICtrlRead($SButton_[$xk]) = "Stop" Then $TimerActive_[$xk] = 0 GUICtrlSetData($SButton_[$xk], "Reset") GUICtrlSetState($TButton_[$xk], $GUI_ENABLE) GUICtrlSetState($Input_[$xk], $GUI_ENABLE) ; GUICtrlSetBkColor($Label_[$xk], 0xD4D0C8) $Name = GUICtrlRead($Input_[$xk]) ; If $xk < 40 Then $Unit = $Header_1 & " " & $xk EndIf EndIf If $xk = 40 Then ExitLoop Next If $msg = $GUI_EVENT_CLOSE Then ExitLoop IF $msg = $buttonTI then $check = GUICtrlRead($act1) ; msgbox( 0, "", $check); for testing If $check == 4 then iniwrite ("timer.ini", "message", "on", "4") If $check == 1 then iniwrite ("timer.ini", "message", "on", "1") endif WEnd Func AllTimers() Local $Secs, $Mins, $Hour For $ck = 1 To $count If $TimerActive_[$ck] Then _TicksToTime(Int(TimerDiff($Timer_[$ck])), $Hour, $Mins, $Secs) $Time_[$ck] = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) If $sTime_[$ck] <> $Time_[$ck] Then GUICtrlSetData($Label_[$ck], $Time_[$ck]) If $Mins == 0 and $Secs == 05 Then; for testing GUICtrlSetBkColor($Label_[$ck], 0x00FF00 );for testing msgbox(0, "5 seconds", "5 seconds");for testing endif If $Mins == 0 and $Secs == 10 Then;for testing GUICtrlSetBkColor($Label_[$ck], 0xF9F900);for testing msgbox(0, "10 seconds", "10 seconds");for testing endif If $Mins == 0 and $Secs == 15 Then;for testing GUICtrlSetBkColor($Label_[$ck], 0xFF4242);for testing msgbox(0, "15 seconds", "15 seconds");for testing endif EndIf Next EndFunc;==>AllTimers The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
seandisanti Posted December 16, 2005 Share Posted December 16, 2005 Ok, tried doing the tab route, and I get a error "Array variable has incorrect number of subscripts or subscript dimention range exceeded". I have no idea what that means.here is the codethe error is usually indicative of a bad loop parameter causing an extra iteration before the exit condition. I'm going to look through the code real quick and see if i can't find it. Link to comment Share on other sites More sharing options...
seandisanti Posted December 16, 2005 Share Posted December 16, 2005 the error is usually indicative of a bad loop parameter causing an extra iteration before the exit condition. I'm going to look through the code real quick and see if i can't find it.looks like your issue is in the For $x = 33 to 40 loop. you're adding 32 to $x in every assignment, so the first time, you're not assigning to $Label_[33], but to $Label_(65) it crashes on the first iteration. remove the +32's Link to comment Share on other sites More sharing options...
seandisanti Posted December 16, 2005 Share Posted December 16, 2005 looks like your issue is in the For $x = 33 to 40 loop. you're adding 32 to $x in every assignment, so the first time, you're not assigning to $Label_[33], but to $Label_(65) it crashes on the first iteration. remove the +32'syou may also want to wait until all of the controls are created to guisetstate() on your gui.. Link to comment Share on other sites More sharing options...
Bert Posted December 17, 2005 Author Share Posted December 17, 2005 I'm not getting what you are talking about. looks like your issue is in the For $x = 33 to 40 loop. you're adding 32 to $x in every assignment, so the first time, you're not assigning to $Label_[33], but to $Label_(65) it crashes on the first iteration. remove the +32's ??????? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
seandisanti Posted December 17, 2005 Share Posted December 17, 2005 I'm not getting what you are talking about. ??????? For $X = 33 To 40 GUICtrlCreateTabItem("Tickets 33-64") ; row 1 GUICtrlCreateLabel($Header_1 & "" & $X + 32, $Left, $Top + 25, 80, 20, $SS_CENTER); ticket lable ex: ticket 1 $Label_[$X + 32] = GUICtrlCreateLabel("", $Left, $Top + 43, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 23, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 32], 16) GUICtrlSetData($Label_[$X + 32], "00:00:00") $TButton_[$X + 32] = GUICtrlCreateButton("Start", $Left, $Top + 73, 50, 20) $SButton_[$X + 32] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 73, 50, 20) $Input_[$X + 32] = GUICtrlCreateInput("", $Left, $Top + 93, 100, 20,0x2000 + 0x1000 + 0x0002) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 116, 100, 20, 0x1000 + 0x0002) $Left = $Left + 110 Next Link to comment Share on other sites More sharing options...
Bert Posted December 17, 2005 Author Share Posted December 17, 2005 I'm still not following you. for example, you point to this... you're not assigning to $Label_[33], but to $Label_(65) I do not see what you are referencing. I know it will hit me like a brick between the eyes at some point, but could you just fix the code for right now so I can see what the problem is? This one is hurting my brain. Please take pity on me.... The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
PerryRaptor Posted December 17, 2005 Share Posted December 17, 2005 How about using GUICtrlCreateCombo() and GUICtrlSetData()...You could create a list of 120 timers and select one in that manner. Link to comment Share on other sites More sharing options...
Bert Posted December 17, 2005 Author Share Posted December 17, 2005 All 120 timers need to be seen as easily as possible. (client requirement) I made some changes, but now the 2nd tab is caught in a loop, and is causing other problems. expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> AutoItSetOption ("TrayIconDebug", 1) Dim $Header_1 = " Ticket" Dim $Name, $TotalTime, $Unit, $count = 32;20 Dim $TimerActive_[50], $Label_[50], $TButton_[50], $SButton_[50], $Input_[50], $Label_[50] Dim $Time_[50], $Timer_[50], $sTime_[50], $xk, $ck, $Left = 0, $Top = 20, $X Dim $Input1_[50], $Input2_[50] Dim $Header_2 = " Ticket" Dim $Name2, $TotalTime2, $Unit2, $count2 = 8;20 Dim $TimerActive2_[50], $Label2_[50], $TButton2[50], $SButton2_[50], $Input2_[50], $Label2_[50] Dim $Time2_[50], $Timer2_[50], $sTime2_[50], $xk2, $ck2, $Left2 = 0, $Top2 = 20, $X2 Dim $Input12_[50], $Input22_[50] AdlibEnable("AllTimers", 500) GUICreate(" T(egg) Timer", 871, 540,-1 ,-1 );,BitOR($WS_MAXIMIZEBOX , $WS_MINIMIZEBOX , $WS_VSCROLL)) GUICtrlSetState(-1,$GUI_DISABLE) GUICtrlSetCursor(-1, 0) GUICtrlCreateTab (-1, -1, 895,540) GUICtrlCreateTabItem("Tickets 1-32") ;label GUICtrlCreateLabel($Header_1 & "s", -20, 23, 890, 18, $SS_CENTER, $WS_EX_STATICEDGE) GUICtrlSetFont(-1, 12, 700) GUICtrlSetBkColor(-1, 0x00ff00) GUICtrlCreateLabel("This tool is NOT to be used for tracking of LOS or warning of SLA.", 205, 730, 130,40,$SS_CENTER) $iniTI = iniread("timer.ini", "message", "on", "") $act1 = GUICtrlCreateCheckbox("Message popup active",10, 715) IF $iniTI == "1" then GUICtrlSetState($act1, $GUI_CHECKED) IF $iniTI == "4" then GUICtrlSetState($act1, $GUI_UNCHECKED) $buttonTI = GUICtrlCreateButton ("&Save Settings", 10, 740, 80) $buttonTI2 = GUICtrlCreateButton ("&How to use T(egg) Timer", 400, 740, 130) For $X = 1 To 8 ; row 1 GUICtrlCreateLabel($Header_1 & "" & $X, $Left, $Top + 25, 80, 20, $SS_CENTER); ticket lable ex: ticket 1 $Label_[$X] = GUICtrlCreateLabel("", $Left, $Top + 43, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 23, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X], 16) GUICtrlSetData($Label_[$X], "00:00:00") $TButton_[$X] = GUICtrlCreateButton("Start", $Left, $Top + 73, 50, 20) $SButton_[$X] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 73, 50, 20) $Input_[$X] = GUICtrlCreateInput("", $Left, $Top + 93, 100, 20,0x2000 + 0x1000 + 0x0002) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 116, 100, 20, 0x1000 + 0x0002) ; row 2 GUICtrlCreateLabel($Header_1 & "" & $X + 8, $Left, $Top + 150, 80, 20, $SS_CENTER) $Label_[$X + 8] = GUICtrlCreateLabel("", $Left, $Top + 170, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 150, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 8], 16) GUICtrlSetData($Label_[$X + 8], "00:00:00") $TButton_[$X + 8] = GUICtrlCreateButton("Start", $Left, $Top + 200, 50, 20) $SButton_[$X + 8] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 200, 50, 20) $Input_[$X + 8] = GUICtrlCreateInput("", $Left, $Top + 220, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 243, 100, 20, 0x1000) ; ;; row 3 GUICtrlCreateLabel($Header_1 & "" & $X + 16, $Left, $Top + 275, 80, 20, $SS_CENTER) $Label_[$X + 16] = GUICtrlCreateLabel("", $Left, $Top + 295, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 275, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 16], 16) GUICtrlSetData($Label_[$X + 16], "00:00:00") $TButton_[$X + 16] = GUICtrlCreateButton("Start", $Left, $Top + 325, 50, 20) $SButton_[$X + 16] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 325, 50, 20) $Input_[$X + 16] = GUICtrlCreateInput("", $Left, $Top + 345, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 368, 100, 20, 0x1000) ; ;; row 4 GUICtrlCreateLabel($Header_1 & "" & $X + 24, $Left, $Top + 400, 80, 20, $SS_CENTER) $Label_[$X + 24] = GUICtrlCreateLabel("", $Left, $Top + 420, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 400, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 24], 16) GUICtrlSetData($Label_[$X + 24], "00:00:00") $TButton_[$X + 24] = GUICtrlCreateButton("Start", $Left, $Top + 450, 50, 20) $SButton_[$X + 24] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 450, 50, 20) $Input_[$X + 24] = GUICtrlCreateInput("", $Left, $Top + 470, 100, 20, 0x1000) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 493, 100, 20, 0x1000) $Left = $Left + 110 Next ;GUISetState() ;second tab----------------------------------------------------------- For $X2 = 1 To 8 GUICtrlCreateTabItem("Tickets 33-64") ; row 1 GUICtrlCreateLabel($Header_2 & "" & $X, $Left2, $Top2 + 25, 80, 20, $SS_CENTER); ticket lable ex: ticket 1 $Label2_[$X2] = GUICtrlCreateLabel("", $Left2, $Top2 + 43, 100, 30, 0x1000) $Input1_[$X2] = GUICtrlCreateInput("", $Left2 + 80, $Top2 + 23, 20, 20, 0x1000) GUICtrlSetFont($Label2_[$X], 16) GUICtrlSetData($Label2_[$X], "00:00:00") $TButton_[$X2 ] = GUICtrlCreateButton("Start", $Left2, $Top2 + 73, 50, 20) $SButton_[$X2] = GUICtrlCreateButton("Stop", $Left2 + 50, $Top2 + 73, 50, 20) $Input2_[$X2] = GUICtrlCreateInput("", $Left2, $Top2 + 93, 100, 20,0x2000 + 0x1000 + 0x0002) $Input22_[$X2] = GUICtrlCreateInput("", $Left2, $Top2 + 116, 100, 20, 0x1000 + 0x0002) $Left = $Left + 110 Next ;------------------ GUISetState() While 1 $msg = GUIGetMsg() For $xk = 1 To $count If $msg = $TButton_[$xk] And GUICtrlRead($Input_[$xk]) > "" Then GUICtrlSetState($TButton_[$xk], $GUI_DISABLE) GUICtrlSetState($Input_[$xk], $GUI_DISABLE) $TimerActive_[$xk] = 1 If Not StringLen(String($Timer_[$xk])) Then $Timer_[$xk] = TimerInit() Else GUICtrlSetData($SButton_[$xk], "Stop") EndIf ElseIf $msg = $TButton_[$xk] Then MsgBox(64, "User Error", "Please Type in a Ticket Number ", 3) EndIf If $msg = $SButton_[$xk] And GUICtrlRead($SButton_[$xk]) = "Reset" Then GUICtrlSetData($Label_[$xk], "00:00:00") GUICtrlSetData($Input_[$xk], "") GUICtrlSetData($SButton_[$xk], "Stop") EndIf If $msg = $SButton_[$xk] And GUICtrlRead($Input_[$xk]) <> "" And GUICtrlRead($SButton_[$xk]) = "Stop" Then $TimerActive_[$xk] = 0 GUICtrlSetData($SButton_[$xk], "Reset") GUICtrlSetState($TButton_[$xk], $GUI_ENABLE) GUICtrlSetState($Input_[$xk], $GUI_ENABLE) ; GUICtrlSetBkColor($Label_[$xk], 0xD4D0C8) $Name = GUICtrlRead($Input_[$xk]) ; If $xk < 40 Then $Unit = $Header_1 & " " & $xk EndIf EndIf If $xk = 40 Then ExitLoop Next If $msg = $GUI_EVENT_CLOSE Then ExitLoop IF $msg = $buttonTI then $check = GUICtrlRead($act1) ; msgbox( 0, "", $check); for testing If $check == 4 then iniwrite ("timer.ini", "message", "on", "4") If $check == 1 then iniwrite ("timer.ini", "message", "on", "1") endif WEnd Func AllTimers() Local $Secs, $Mins, $Hour For $ck = 1 To $count If $TimerActive_[$ck] Then _TicksToTime(Int(TimerDiff($Timer_[$ck])), $Hour, $Mins, $Secs) $Time_[$ck] = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) If $sTime_[$ck] <> $Time_[$ck] Then GUICtrlSetData($Label_[$ck], $Time_[$ck]) If $Mins == 0 and $Secs == 05 Then; for testing GUICtrlSetBkColor($Label_[$ck], 0x00FF00 );for testing msgbox(0, "5 seconds", "5 seconds");for testing endif If $Mins == 0 and $Secs == 10 Then;for testing GUICtrlSetBkColor($Label_[$ck], 0xF9F900);for testing msgbox(0, "10 seconds", "10 seconds");for testing endif If $Mins == 0 and $Secs == 15 Then;for testing GUICtrlSetBkColor($Label_[$ck], 0xFF4242);for testing msgbox(0, "15 seconds", "15 seconds");for testing endif EndIf Next EndFunc;==>AllTimers The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
seandisanti Posted December 17, 2005 Share Posted December 17, 2005 I'm still not following you. for example, you point to this... I do not see what you are referencing. I know it will hit me like a brick between the eyes at some point, but could you just fix the code for right now so I can see what the problem is? This one is hurting my brain. Please take pity on me.... For $X = 33 To 40 GUICtrlCreateTabItem("Tickets 33-64") ; row 1 GUICtrlCreateLabel($Header_1 & "" & $X + 32, $Left, $Top + 25, 80, 20, $SS_CENTER); ticket lable ex: ticket 1 $Label_[$X + 32] = GUICtrlCreateLabel("", $Left, $Top + 43, 100, 30, 0x1000) $Input1_[$X] = GUICtrlCreateInput("", $Left + 80, $Top + 23, 20, 20, 0x1000) GUICtrlSetFont($Label_[$X + 32], 16) GUICtrlSetData($Label_[$X + 32], "00:00:00") $TButton_[$X + 32] = GUICtrlCreateButton("Start", $Left, $Top + 73, 50, 20) $SButton_[$X + 32] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 73, 50, 20) $Input_[$X + 32] = GUICtrlCreateInput("", $Left, $Top + 93, 100, 20,0x2000 + 0x1000 + 0x0002) $Input2_[$X] = GUICtrlCreateInput("", $Left, $Top + 116, 100, 20, 0x1000 + 0x0002) $Left = $Left + 110 Next see what i mean about assigning to $label_[65] ? Link to comment Share on other sites More sharing options...
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