Jump to content

Recommended Posts

Posted

So in my program, I have a button that needs to be one of 3 colors. The default, blue, or gray. throughout the program, the button changes colors depending on whats going on. I need to be able to change it back to default colors, but i can't figure it out. Ive tried setting it to transparent, but that didnt work. Is there some variable for setting GUICtrlSetBkColor to default, or to delete the old GUICtrlSetBkColor's? Sorta Example code below. Isnt what the code is, but same application

#include <guiconstants.au3>

$gui1 = GUICreate("button", 150,150)

$button = GuiCtrlCreateButton("Button!", 50, 50,50,50)
GUISetState ()
While 1
Sleep(2000)
GUICtrlSetBkColor($button,0x99CCFF); Blue
Sleep(2000)
GUICtrlSetBkColor($button,0x999999); gray
Sleep(2000)
GUICtrlSetBkColor($button,0xFFFFFF); back to default, or delete old colors.
WEnd
Posted

Sorry, I dont really get it. How would I use this exactually in the code above. Keep in mind that this can only affect this one button, not every button in the script.

Thanks

Posted

0xECE9D8 makes the button a kinda Beige color, but doesnt set it back to default. By default, the button is a multi-shade deal, light at the top, and darker at the bottom.

You'de think something like this would be easy, but this has caused me more rustration than anything else in this project so far, lol.

Posted (edited)

So in my program, I have a button that needs to be one of 3 colors. The default, blue, or gray. throughout the program, the button changes colors depending on whats going on. I need to be able to change it back to default colors, but i can't figure it out. Ive tried setting it to transparent, but that didnt work. Is there some variable for setting GUICtrlSetBkColor to default, or to delete the old GUICtrlSetBkColor's? Sorta Example code below. Isnt what the code is, but same application

#include <guiconstants.au3>

$gui1 = GUICreate("button", 150,150)

$button = GuiCtrlCreateButton("Button!", 50, 50,50,50)
GUISetState ()
While 1
Sleep(2000)
GUICtrlSetBkColor($button,0x99CCFF); Blue
Sleep(2000)
GUICtrlSetBkColor($button,0x999999); gray
Sleep(2000)
GUICtrlSetBkColor($button,0xFFFFFF); back to default, or delete old colors.
WEnd

I don't know the answer, but if you're desperate this is what I would do (I have no pride)

GuiCtrlDelete($button)

$button = guiCtrlCreateButton(.... etc

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

Yea, Martin, that works great. Kinda annoying that you have to delete-then re-creat the button, but whatever. As long as it works.

Thanks again!

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
×
×
  • Create New...