Jump to content

Constant Color Change


toothyXdip
 Share

Recommended Posts

Is there a way to make it where there is a constant loop of color change for a label without a ton of "If's" and does without the help of a button send

---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
Link to comment
Share on other sites

Maybe... AdLib()

#include <GUIConstants.au3>

Dim $num

$Form = GUICreate("Demo")
$label = GUICtrlCreateLabel("Color changing text", 50, 150, 200, 20)
GUISetState(@SW_SHOW, $Form)

AdlibEnable("Color_Change", 500)

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then Exit
WEnd
    
Func Color_Change()
    $num += 1
    $color = StringSplit("0xfffafa,0xdcdcdc,0x000080,0xcd5c5c", ",")
    If $num > $color[0] Then $num = 1
    Return GUICtrlSetColor($label, $color[$num])
EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

thanks =)

yeah i dont really know how to use arrays or a lot of the functions yet so that might have helped lol

thanks again

P.S. i have a question about what is happening in this script ok so tell me where im wrong

the AdlibEnable is telling to evaluate the function colorchange every 500 milliseconds making it loop the colorchange

then is the $num +=1 telling it how fast to do the color changes in the StringSplit?

and the return is telling it what to make out of all of that and that is to change the color accordingly to the array returned from the StringSplit function?

0.o

Edited by toothyXdip
---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
Link to comment
Share on other sites

the AdlibEnable is telling to evaluate the function colorchange every 500 milliseconds making it loop the colorchange

Yes

then is the $num +=1 telling it how fast to do the color changes in the StringSplit?

Actually, the $num is telling which color to use next #1 through #5

and the return is telling it what to make out of all of that and that is to change the color accordingly to the array returned from the StringSplit function?

Yes, and if there is any error that will be sent too.

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

thanks yeah i think im going to look up a array tut or read the whole array help files lol

well thanks again this and reading some of your other scrips has helped me to learn alot

---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
Link to comment
Share on other sites

and the return is telling it what to make out of all of that and that is to change the color accordingly to the array returned from the StringSplit function?

Yes, and if there is any error that will be sent too.

???

How does that work? A return in an Adlib function doesn't do anything does it? Where is it returning the value to??

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...