barrikid Posted October 12, 2010 Posted October 12, 2010 I am not able to update the color of a label after it has been set. Here is just a snippet, I just took fragments of the code GUICreate("Gui", 500, 500, 0, 0) $lCityName = GUICtrlCreateLabel("", 10, 60, 50, 50) GUICtrlSetBkColor($lCityName, $white) ;Defined white and black earlier GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_PRIMARYDOWN Then GUICtrlSetBkColor($lCityName, $black) EndIf Wend I am able to set the color up top, but not during the loop, any reason why? Thanks, BK
martin Posted October 12, 2010 Posted October 12, 2010 I am not able to update the color of a label after it has been set. Here is just a snippet, I just took fragments of the code GUICreate("Gui", 500, 500, 0, 0) $lCityName = GUICtrlCreateLabel("", 10, 60, 50, 50) GUICtrlSetBkColor($lCityName, $white) ;Defined white and black earlier GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_PRIMARYDOWN Then GUICtrlSetBkColor($lCityName, $black) EndIf Wend I am able to set the color up top, but not during the loop, any reason why? Thanks, BK ; *** Start added by AutoIt3Wrapper *** #include <GUIConstantsEx.au3> ; *** End added by AutoIt3Wrapper *** #AutoIt3Wrapper_Add_Constants=n GUICreate("Gui", 500, 500, 0, 0) $lCityName = GUICtrlCreateLabel("", 10, 60, 50, 50) GUICtrlSetBkColor($lCityName, 0xffffff) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_PRIMARYDOWN Then GUICtrlSetBkColor($lCityName, 0) EndIf if $msg = -3 then Exit Wend works fine so I think something else is wrong. I think it is more sensible to post exactly the code you are having problems with, code which we can run, and especially don't post code that doesn't show what you are talking about so that we reach a conclusion more efficiently. ( Or in other words, so we don't waste our time:)). 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.
Moderators Melba23 Posted October 12, 2010 Moderators Posted October 12, 2010 barrikid, Works for me - does it not work for you? #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $lCityName = GUICtrlCreateLabel("", 10, 60, 50, 50) GUICtrlSetBkColor($lCityName, 0xFF0000) GUISetState() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN GUICtrlSetBkColor($lCityName, 0x0000FF) EndSwitch WEnd M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
barrikid Posted October 12, 2010 Author Posted October 12, 2010 (edited) barrikid,Works for me - does it not work for you? ...M23Yup, thanks, ill have to see why it doesn't work on mineBK Edited October 12, 2010 by barrikid
Moderators Melba23 Posted October 12, 2010 Moderators Posted October 12, 2010 barrikid, I cannot imagine how Win7 would prevent that script from working. Have you tried rebooting your machine and then running the script again? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
GEOSoft Posted October 12, 2010 Posted October 12, 2010 I have a hunch it's in the way you declared your colors, of course it's a guess because you didn't post the declarations for the colors. $Black = 0x000000 is correct, whereas $Black = "0x000000" is incorect. The colors are already inside ColorConstants.au3 so why not use them? This works fine and all I've done is change your color variables to the correct names as used in the constants file. #Include<ColorConstants.au3> #Include<GuiConstants.au3> GUICreate("Gui", 500, 500, 0, 0) $lCityName = GUICtrlCreateLabel("", 10, 60, 50, 50) GUICtrlSetBkColor($lCityName, $Clr_White) ;Defined white and black earlier GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_PRIMARYDOWN Then GUICtrlSetBkColor($lCityName, $Clr_Black) EndIf If $Msg = -3 Then Exit Wend George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
barrikid Posted October 12, 2010 Author Posted October 12, 2010 Ah, I had $gui = GUICreate("Test", 500, 700, 0, 0, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) I took out the BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN), and it worked
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