I am trying to change the background colour of list items based on whether the panels they are associated with are active. I have tried a number of ways without success. I thought that the code below would work:
Code: Select all
void GUI::SetPanelState(long index, bool active)
{
Panels.at(index)->SetActive(active);
if(active)
{
m_list->SetItemBackgroundColour(index,*wxWHITE);
}
else
{
m_list->SetItemBackgroundColour(index,*wxLIGHT_GREY);
}
m_list->RefreshItem(index);
}
Second, the code above doesn't have any effect on the control. The code below also seemed useless in this regard:
Code: Select all
void GUI::SetPanelState(long index, bool active)
{
wxListItem item;
Panels.at(index)->SetActive(active);
item = Panels.at(index)->GetListItem();
m_list->SetItem(item);
m_list->RefreshItem(index) // RefreshItem is actually called in wxListView::SetItem() if the colour has changed
}
It doesn't seem like using SetBackgroundColour() on a list item or SetItemBackgroundColour on the wxListView control should present any challenges, in fact it seems like a pretty basic function call. Does anybody see the problem in the code above?