Kohr Posted October 23, 2006 Share Posted October 23, 2006 I am using code that will add values to a listview and using GUICtrlSetBkColor to color each row. This works fine unless: 1. I have another window open. While the other window is open the listview coloring just acts crazy. 2. I use anything other than "-1" as the control reference. I attached an example of how it works and will not work. Hitting either the red or blue buttons will add a row in the listview with a BkColor. Open up the example options window "hit button >>>" then use the same buttons and the color is not set. Does anyone have any suggestions? Kohr expandcollapse popup#include <GUIConstants.au3> #Include <Misc.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) Opt("MouseCoordMode", 0) Global $GUIoptions HotKeySet("{END}", "CloseClicked") $GUImain = GUICreate("", 300, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MINIMIZEBOX + $WS_MAXIMIZEBOX) $btnOptions = GUICtrlCreateButton("> > >", 1, 10, 18, 50, $BS_MULTILINE) GUICtrlSetOnEvent($btnOptions, "Options") $List1 = GUICtrlCreateListView("A|B|C|D|F", 20, 10, 210, 200, $LVS_SHOWSELALWAYS, $LVS_EX_FULLROWSELECT + $WS_EX_CLIENTEDGE + $LVS_EX_GRIDLINES) $btnBlue = GUICtrlCreateButton("Blue", 10, 220, 50, 20) GUICtrlSetOnEvent($btnBlue, "Blue") $btnRed = GUICtrlCreateButton("Red", 60, 220, 50, 20) GUICtrlSetOnEvent($btnRed, "Red") GUISetState(@SW_SHOW, $GUImain) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseClicked") While 1 Sleep(200) $gReturn = 0 WEnd Func Options() If GUICtrlRead($btnOptions) = "> > >" Then $GUIoptions = GUICreate("", 220, 200, 0, 0, -1, $WS_EX_TOOLWINDOW) GUICtrlSetData($btnOptions, "< < <") GUISetState(@SW_SHOW, $GUIoptions) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseOptions") Else GUIDelete($GUIoptions) GUICtrlSetData($btnOptions, "> > >") EndIf EndFunc ;==>Options Func Blue() GUICtrlCreateListViewItem("B|L|U|E||", $List1) GUICtrlSetBkColor(-1, "0x00000FF") EndFunc ;==>Blue Func Red() GUICtrlCreateListViewItem("R|E|D|||", $List1) GUICtrlSetBkColor(-1, "0xFF00000") EndFunc ;==>Red Func CloseOptions() GUIDelete($GUIoptions) GUICtrlSetData($btnOptions, "> > >") EndFunc ;==>CloseOptions Func CloseClicked() Exit EndFunc ;==>CloseClicked AutoIt LinksAutoIt CrapsGrid_PixelSearchAdvancedPixelGrab Link to comment Share on other sites More sharing options...
BigDod Posted October 23, 2006 Share Posted October 23, 2006 This works for me expandcollapse popup#include <GUIConstants.au3> #Include <Misc.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) Opt("MouseCoordMode", 0) Global $GUIoptions HotKeySet("{END}", "CloseClicked") $GUImain = GUICreate("", 300, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MINIMIZEBOX + $WS_MAXIMIZEBOX) $btnOptions = GUICtrlCreateButton("> > >", 1, 10, 18, 50, $BS_MULTILINE) GUICtrlSetOnEvent($btnOptions, "Options") $List1 = GUICtrlCreateListView("A|B|C|D|F", 20, 10, 210, 200, $LVS_SHOWSELALWAYS, $LVS_EX_FULLROWSELECT + $WS_EX_CLIENTEDGE + $LVS_EX_GRIDLINES) $btnBlue = GUICtrlCreateButton("Blue", 10, 220, 50, 20) GUICtrlSetOnEvent($btnBlue, "Blue") $btnRed = GUICtrlCreateButton("Red", 60, 220, 50, 20) GUICtrlSetOnEvent($btnRed, "Red") GUISetState(@SW_SHOW, $GUImain) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseClicked") While 1 Sleep(200) $gReturn = 0 WEnd Func Options() If GUICtrlRead($btnOptions) = "> > >" Then $GUIoptions = GUICreate("", 220, 200, 0, 0, -1, $WS_EX_TOOLWINDOW) GUICtrlSetData($btnOptions, "< < <") GUISetState(@SW_SHOW, $GUIoptions) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseOptions") Else GUIDelete($GUIoptions) GUICtrlSetData($btnOptions, "> > >") EndIf EndFunc ;==>Options Func Blue() $bl = GUICtrlCreateListViewItem("B|L|U|E||", $List1) ; <-------- Changed GUICtrlSetBkColor($bl, "0x00000FF") EndFunc ;==>Blue Func Red() $rd = GUICtrlCreateListViewItem("R|E|D|||", $List1) ; <-------- Changed GUICtrlSetBkColor($rd, "0xFF00000") EndFunc ;==>Red Func CloseOptions() GUIDelete($GUIoptions) GUICtrlSetData($btnOptions, "> > >") EndFunc ;==>CloseOptions Func CloseClicked() Exit EndFunc ;==>CloseClicked Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Kohr Posted October 23, 2006 Author Share Posted October 23, 2006 Thanks BigDod. That works great. AutoIt LinksAutoIt CrapsGrid_PixelSearchAdvancedPixelGrab Link to comment Share on other sites More sharing options...
BigDod Posted October 23, 2006 Share Posted October 23, 2006 Your welcome. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother 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