jmosley708 Posted July 21, 2008 Share Posted July 21, 2008 I've created some buttons and I've used guictrlsetbkcolor to change their colors. I want to make the buttons flash two alternating colors, but I want to alternate with the exsisting color to another color. There is no command to get the bkcolor and I don't want to use pixelsearch, because I would have to know the coordinates for the buttons. Is there another way to get the background color from the button? Link to comment Share on other sites More sharing options...
James Posted July 21, 2008 Share Posted July 21, 2008 Set a variable for the two colors and use that muttley Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
rasim Posted July 22, 2008 Share Posted July 22, 2008 I've created some buttons and I've used guictrlsetbkcolor to change their colors. I want to make the buttons flash two alternating colors, but I want to alternate with the exsisting color to another color. There is no command to get the bkcolor and I don't want to use pixelsearch, because I would have to know the coordinates for the buttons. Is there another way to get the background color from the button? Hi! 2 examples: get color: expandcollapse popup#include <GUIConstantsEx.au3> Opt("PixelCoordMode", 2) $hGUI = GUICreate("Get button color", 200, 100) $button = GUICtrlCreateButton("Test", 60, 20, 75, 23) GUICtrlSetBkColor(-1, 0xFF0000) ;red color $GetColor_Button = GUICtrlCreateButton("Get", 60, 60, 75, 23) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GetColor_Button $aPos = ControlGetPos($hGUI, "", $button) $Color = PixelGetColor($aPos[0] + 3, $aPos[1] + 3) $Color = "0x" & Hex($Color, 6) MsgBox(0, "Color", $Color) EndSwitch WEndoÝ÷ ÙÈZ¢Z+jëh×6#include <GUIConstantsEx.au3> Global $color = 0xFF0000 Opt("PixelCoordMode", 2) $hGUI = GUICreate("Get button color", 200, 100) $button = GUICtrlCreateButton("Test", 60, 40, 75, 23) GUICtrlSetBkColor(-1, $color) GUISetState() AdlibEnable("_SetColor", 500) Do Until GUIGetMsg() = -3 Func _SetColor() $color = BitNOT($color) GUICtrlSetBkColor($button, $color) EndFunc muttley Link to comment Share on other sites More sharing options...
crzftx Posted July 24, 2008 Share Posted July 24, 2008 $color = 0xFFFFFF - $color That changes the color to it's inverse each time, instead of to black... I would probably use 2 separate colors. #include <GUIConstantsEx.au3> Global $color = 0xFF0000 Opt("PixelCoordMode", 2) $hGUI = GUICreate("Get button color", 200, 100) $button = GUICtrlCreateButton("Test", 60, 40, 75, 23) GUICtrlSetBkColor(-1, $color) GUISetState() AdlibEnable("_SetColor", 500) Do Until GUIGetMsg() = -3 Func _SetColor() If $color = 0xFF0000 Then $color = 0x00FF00 Else $color = 0xFF0000 EndIf GUICtrlSetBkColor($button, $color) EndFunc Link to comment Share on other sites More sharing options...
Xenobiologist Posted December 21, 2008 Share Posted December 21, 2008 Hi, why is it so hard to implement ...getbkColor functions? Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times 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