flyingboz Posted August 28, 2004 Share Posted August 28, 2004 I wrote this code snippet to test where I'm failing - can someone more experienced take a quick look at this - code attempts to change label text and color - text change works, color change doesn't - using latest build of .103 $dec_color = _ChgLabelColor() Exit $dec_color Func _ChgLabelColor () opt("trayicondebug",1) Opt ("GUINotifyMode", 1) Opt("ColorMode",0) local $hwnd = GuiCreate("this is a window",100,100) ;build a sample array of colors to test local $test_color = "0x000000,0xFF0000,0x00FF00,0x0000FF,0xFFFFFF" local $color = StringSplit($test_color,',') ;initialize control $text = GUISetControl("label","text",1,1,100,100) GuiShow() ;loop through array of colors For $i = 1 to Ubound($color) -1 sleep(3000) GUIWrite($text,0,$color[$i]); change label text in control GUISetControlEX($text,0,0,"",$color[$i]) ;change color of control GUIShow() ;display results - no expected change of color in text Next EndFunc Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
Holger Posted August 28, 2004 Share Posted August 28, 2004 (edited) Are you sure that your GUISetControlEx is on a NEW line, otherwise it is commented.I saw..the problem is the color.Color has to be an numeric value NOT a string!Edit:Here is another idea...$dec_color = _ChgLabelColor() Exit $dec_color Func _ChgLabelColor () opt("trayicondebug",1) Opt ("GUINotifyMode", 1) Opt("ColorMode",0) local $hwnd = GuiCreate("this is a window",100,100) ;build a sample array of colors to test local $color[5] $color[0] = 0x000000 $color[1] = 0xFF0000 $color[2] = 0x00FF00 $color[3] = 0x0000FF $color[4] = 0xFFFFFF ;initialize control $text = GUISetControl("label","text",1,1,100,100) GuiShow() ;loop through array of colors For $i = 0 to Ubound($color) -1 sleep(3000) GUIWrite($text,0,$color[$i]); change label text in control GUISetControlEX($text,0,0,"",$color[$i]);change color of control Next EndFunc Edited August 28, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
flyingboz Posted August 29, 2004 Author Share Posted August 29, 2004 Color has to be an numeric value NOT a string!From the help file:Integers (whole numbers) can also be represented in hexadecimal notation by preceding the integer with 0x as in 0x409 or 0x4fff (when using hex notation only 32-bit numbers are valid). From the changelog detailing build 102:Added: Strings starting with "0x" are converted from hex when used numericallyHolger, this does seem to be the problem - should I report this as a potential bug?Is there a way to force the hex string to an integer? I tried number() and Int(), neither succeed. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
Holger Posted August 31, 2004 Share Posted August 31, 2004 Problem is solved in the current unstable build (thanks to Jon) Only for your info... Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView 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