Sign in to follow this  
Followers 0
Delta01

Changing a GUI's color. Then back etc

2 posts in this topic

Hi,

I'm making a script using a countdown, when the countdown gets to 0 I get the script to change all text associated with that countdown to red. Then, the user has to manually restart the countdown. I can't find a way to make the timer to change back to black, from red. I know the hex code etc etc.

When I try to make it black again, the text goes black but it flickers a lot. So, can somebody please edit this portion of my code so that it wont flicker when it goes back to black.

Case $Time = "00:00:01"
            GuiCtrlSetColor($User1Gold, 0xff0000)
            GUICtrlSetColor($User1Time, 0xff0000)
            GUICtrlSetColor($LabelUser1, 0xff0000)
            If GuiCtrlRead($Sound) = $GUI_CHECKED Then SoundPlay(@ScriptDir & "\TaxiAlert.wav")
                ;**Some more code here.
                
                Func SetupUser1()
    $User1 = InputBox("User's name", "Enter the user's name below.", "BoT90210")
    $Count1 = InputBox("Time paid for", "How many hours did " & $User1 & " pay for?", "2")
    $number1 = $Count1 * 3600000
    $Gold1 = InputBox("Amount paid", "How much gold did they pay you?", "100,000")
    $Msg1 = MsgBox(4, "Set up complete", "The set up for user: " & $User1 & " is complete." & @CRLF & @CRLF & "Do you wish to start the timer?")
    If $Msg1 = 6 Then
        GUICtrlDelete($Add1)
        $LabelUser1 = GUICtrlCreateLabel($User1, 10, 45)
        $User1Gold = GUICtrlCreateLabel($Gold1, 150, 45)
        $timer = TimerInit()
        $bRunTimer1 = 1
    ElseIf $Msg1 = 7 Then
        Sleep(500)
    EndIf
EndFunc  

Func Timer1()
    $iTimeToGo = $number1 - Int(TimerDiff($timer))
    _TicksToTime($iTimeToGo, $Hour, $Mins, $Secs)
    ConsoleWrite($timer & @CRLF)
    ConsoleWrite(TimerDiff($timer) & @CRLF)
    Local $sTime = $Time 
    $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    If $sTime <> $Time Then ControlSetText("Taxi Script", "", "Static1", $Time)
    If $iTimeToGo <= 0 then
    ControlSetText("Taxi Script", "", "Static1", "00:00:00")
    If $iTimeToGo <= 0 Then $bRunTimer1 = 0
        Endif
        EndFunc

Share this post


Link to post
Share on other sites



Hi,

I'm making a script using a countdown, when the countdown gets to 0 I get the script to change all text associated with that countdown to red. Then, the user has to manually restart the countdown. I can't find a way to make the timer to change back to black, from red. I know the hex code etc etc.

When I try to make it black again, the text goes black but it flickers a lot. So, can somebody please edit this portion of my code so that it wont flicker when it goes back to black.

I only see code for red, no black. So you are not showing the code relevant to flickering when it goes to black. Without seeing the code, though, it is most likely you are changing it over-and-over in a loop. Make sure your logic changes it once and leaves it alone.

<_<


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0