I’ve created an UltimateListCtrl, I’ve changed certain items fore and background colors…
When not using the ULC_BORDER_SELECT style color look pretty horrible for different rows (they aren’t all the same color on selection), but when using the ULC_BORDER_SELECT option, the items which I called SetBackgroundColour all have the border selection blue bounding box ALWAYS drawn… as in when you do actually select one of them, you don’t see a visual difference for that row, at all (the row that was previously selected will have its bounding box removed, if it wasn’t a SetBackgroundColour affected item).
Here’s a simple working example demonstrating the problem… see how the middle row looks:
import wx
from wx.lib.agw import ultimatelistctrl as ULC
class TestUltimateListCtrl(ULC.UltimateListCtrl):
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=0):
ULC.UltimateListCtrl.__init__(self, parent, id, pos, size, style, agwStyle)
···
########################################################################
class TestPanel(wx.Panel):
""""""
#----------------------------------------------------------------------
def __init__(self, parent):
"""Constructor"""
wx.Panel.__init__(self, parent)
font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
boldfont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
boldfont.SetWeight(wx.BOLD)
boldfont.SetPointSize(12)
self.ultimateList = TestUltimateListCtrl(self, agwStyle = wx.LC_REPORT
> wx.LC_VRULES
> wx.LC_HRULES | ULC.ULC_BORDER_SELECT)#|ULC.ULC_EDIT_LABELS)
info = ULC.UltimateListItem()
info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT |ULC.ULC_MASK_FONTCOLOUR#| ULC.ULC_MASK_CHECK# |ULC.ULC_EDIT_LABELS
#info._image = []
info._format = 0
#info._kind = 1
info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT | ULC.ULC_MASK_BACKCOLOUR
info._font = font
info.SetMask(ULC.ULC_MASK_FONTCOLOUR| wx.LIST_MASK_WIDTH | wx.LIST_MASK_TEXT| wx.LIST_MASK_FORMAT )
info.SetTextColour(wx.Colour(255,0,0))
info._text = "Artist Name"
self.ultimateList.InsertColumnInfo(0, info)
info = ULC.UltimateListItem()
info._format = wx.LIST_FORMAT_RIGHT
info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT | ULC.ULC_MASK_FONTCOLOUR#|ULC.ULC_EDIT_LABELS
#info._image = []
info._text = "Title"
#info._font = boldfont
self.ultimateList.InsertColumnInfo(1, info)
info = ULC.UltimateListItem()
info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT | ULC.ULC_MASK_FONTCOLOUR#|ULC.ULC_EDIT_LABELS
info._format = 0
info._text = "Genre"
#info._font = font
#info._image = []
self.ultimateList.InsertColumnInfo(2, info)
self.ultimateList.InsertStringItem(0, "Puffy")
self.ultimateList.SetStringItem(0, 1, "Bring It!")
self.ultimateList.SetStringItem(0, 2, "Pop")
item2 = self.ultimateList.GetItem(0, 1)
item3 = self.ultimateList.GetItem(0, 2)
item2.SetMask(ULC.ULC_MASK_FONTCOLOUR| wx.LIST_MASK_WIDTH)
item3.SetMask(ULC.ULC_MASK_FONTCOLOUR| wx.LIST_MASK_WIDTH)
item2.SetTextColour(wx.Colour(255,0,0))
item3.SetTextColour(wx.Colour(255,0,0))
self.ultimateList.SetItem(item2)
self.ultimateList.SetItem(item3)
self.ultimateList.InsertStringItem(1, "Newsboys")
self.ultimateList.SetStringItem(1, 1, "Go")
self.ultimateList.SetStringItem(1, 2, "Rock")
item1 = self.ultimateList.GetItem(1, 0)
item2 = self.ultimateList.GetItem(1, 1)
item3 = self.ultimateList.GetItem(1, 2)
item1.SetMask(ULC.ULC_MASK_BACKCOLOUR| wx.LIST_MASK_WIDTH)
item2.SetMask(ULC.ULC_MASK_BACKCOLOUR| wx.LIST_MASK_WIDTH)
item3.SetMask(ULC.ULC_MASK_BACKCOLOUR| wx.LIST_MASK_WIDTH)
item1.SetBackgroundColour(wx.Colour(242,242,242))
item2.SetBackgroundColour(wx.Colour(242,242,242))
item3.SetBackgroundColour(wx.Colour(242,242,242))
self.ultimateList.SetItem(item1)
self.ultimateList.SetItem(item2)
self.ultimateList.SetItem(item3)
self.ultimateList.InsertStringItem(2, "Family Force 5")
self.ultimateList.SetStringItem(2, 1, "III")
self.ultimateList.SetStringItem(2, 2, "Crunk")
item2 = self.ultimateList.GetItem(2, 1)
item3 = self.ultimateList.GetItem(2, 2)
item2.SetMask(ULC.ULC_MASK_FONTCOLOUR| wx.LIST_MASK_WIDTH)
item3.SetMask(ULC.ULC_MASK_FONTCOLOUR| wx.LIST_MASK_WIDTH)
item2.SetTextColour(wx.Colour(111,158,219))
item3.SetTextColour(wx.Colour(111,158,219))
self.ultimateList.SetItem(item2)
self.ultimateList.SetItem(item3)
self.ultimateList.SetColumnWidth(0, wx.LIST_AUTOSIZE_USEHEADER)
self.ultimateList.SetColumnWidth(1, wx.LIST_AUTOSIZE_USEHEADER)
self.ultimateList.SetColumnWidth(2, -3)
self.ultimateList.SetColumnWidth(0, wx.LIST_AUTOSIZE)#150)
self.ultimateList.SetColumnWidth(1, wx.LIST_AUTOSIZE)#200)
self.ultimateList.SetColumnWidth(2, -3)#100)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.ultimateList, 1, wx.EXPAND)
self.SetSizer(sizer)
########################################################################
class TestFrame(wx.Frame):
""""""
#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
wx.Frame.__init__(self, None, title="MvP UltimateListCtrl Demo")
panel = TestPanel(self)
self.Show()
#----------------------------------------------------------------------
if name == “main”:
app = wx.App(False)
frame = TestFrame()
app.MainLoop()