Search the Community
Showing results for tags 'listview colors'.
-
So I think I found a bug but since it's "usually me" that's wrong, I'm coming here for confirmation. I was writing a script and I was trying to get the window background and the listview background and the listview items background all to be the same color. The problem was I was they were different even though they were using the same color values. The hex of the basic colors of red green and blue would be: FF0000 red 00FF00 green 0000FF blue. What appears to happen is the first two digits in the last two digits are transposed when the color is set on the listview. When I read the values from the controls they are correct, it's the colors that are wrong. So red becomes blue becomes red. I've written a small program to show the errors. First note that looking at the code below the text background should be blue and the listview background should be red. Instead it's just the reverse. _GUICtrlListView_SetTextBkColor($List1,$color_blue) _GUICtrlListView_SetBkColor($List1,$color_red) ;Color Test #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <ColorConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $hGUI = GUICreate("Form1", 290, 169, 192, 124) $List1 = GUICtrlCreateListView("Col 1", 48, 16, 89, 110,$LVS_SHOWSELALWAYS) $Input1 = GUICtrlCreateInput("0x0000FF", 168, 16, 100, 21) $Input2 = GUICtrlCreateInput("0xFF0000", 168, 48, 100, 21) $Button1 = GUICtrlCreateButton("Button1", 168, 80, 65, 17) $Button2 = GUICtrlCreateButton("Button2", 168, 104, 65, 17) GUICtrlCreateListViewItem("One", $List1) GUICtrlCreateListViewItem("Two", $List1) GUICtrlCreateListViewItem("Three", $List1) _GUICtrlListView_SetTextBkColor($List1,$color_blue) _GUICtrlListView_SetBkColor($List1,$color_red) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $ic=number(GUICtrlRead($Input1)) ConsoleWrite($ic & @CRLF) GUISetBkColor ($ic ,$hGUI ) _GUICtrlListView_SetTextBkColor($List1,$ic) _GUICtrlListView_SetBkColor($List1,$ic) tooltip(Hex(_GUICtrlListView_GetTextBkColor($List1))) Case $Button2 $ic=number(GUICtrlRead($Input2)) ConsoleWrite($ic & @CRLF) GUISetBkColor ($ic ,$hGUI ) _GUICtrlListView_SetTextBkColor($List1,$ic) _GUICtrlListView_SetBkColor($List1,$ic) tooltip(Hex(_GUICtrlListView_GetTextBkColor($List1))) EndSwitch WEnd Button1 should apply the color red in the first input box (red) to the window background, listview background and the listview text back color. The Button2 two should make them all blue. As you can see the background color for the window does what it's supposed to do but the listview doesn't. Note if you apply green 00FF00 then everything works right. The middle two digits are left alone. The tool tip is showing the color value on the control using Hex(_GUICtrlListView_GetTextBkColor($List1)). Which shows the value on the control is correct it's the color that is wrong. Thanks to anyone that took the time to look at this and please let me know you think.