I've created a wxDataViewListCtrl. When the program runs, some rows will have active data, and some rows will have "inactive" data.
Is there a way that I can change the background color of the inactive rows to gray? Assume the background color would "key off" one of the fields. I do know about the wxDV_HORIZ_RULES, but that's every other row no matter what the contents of the row are.
Thanks!
Colleen
wxDataViewListCtrl: Change the background color for selectedrows? Topic is solved
-
- Earned some good credits
- Posts: 109
- Joined: Mon Aug 31, 2015 3:47 pm
-
- Part Of The Furniture
- Posts: 7481
- Joined: Sat Apr 16, 2005 7:22 am
- Location: USA, Ukraine
Re: wxDataViewListCtrl: Change the background color for selectedrows?
Hi,
Didi you look at the 'dataview' sample?
Thank you.
Didi you look at the 'dataview' sample?
Thank you.
-
- Earned some good credits
- Posts: 109
- Joined: Mon Aug 31, 2015 3:47 pm
Re: wxDataViewListCtrl: Change the background color for selectedrows?
Thank you for answering, OneEyeMan.
Yes, I looked at the wxDataViewCtrl sample. There was a tab there showing a wxDataViewListCtrl, but all the rows had a white background.
There was also a tab called MyListModel with different colors of text, but the row backgrounds were also all white.
Colleen
Yes, I looked at the wxDataViewCtrl sample. There was a tab there showing a wxDataViewListCtrl, but all the rows had a white background.
There was also a tab called MyListModel with different colors of text, but the row backgrounds were also all white.
Colleen
-
- Moderator
- Posts: 19163
- Joined: Fri Apr 21, 2006 8:03 pm
- Location: $FCE2
Re: wxDataViewListCtrl: Change the background color for selectedrows?
As usual, a look into the sources reveals the ultimate truth...
Under Windows wxDVC uses wxRendererNative::Get().DrawItemSelectionRect() to draw the cell background...
... and that uses system colors for the background with no simple way to override them.
Under Windows wxDVC uses wxRendererNative::Get().DrawItemSelectionRect() to draw the cell background...
Code: Select all
wxBrush brush;
if ( flags & wxCONTROL_SELECTED )
{
if ( flags & wxCONTROL_FOCUSED )
{
brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
}
else // !focused
{
brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
}
}
else // !selected
{
brush = *wxTRANSPARENT_BRUSH;
}
Use the source, Luke!
-
- Earned some good credits
- Posts: 109
- Joined: Mon Aug 31, 2015 3:47 pm
Re: wxDataViewListCtrl: Change the background color for selectedrows?
Doublemax,
Thank you for investigating the background color issue for me. I wouldn't have known where to START looking.
It sounds like changing the background color in a wxDataViewListCtrl involves more time and energy than the results warrant. Too bad, but OK.
Thanks again!
Colleen
Thank you for investigating the background color issue for me. I wouldn't have known where to START looking.
It sounds like changing the background color in a wxDataViewListCtrl involves more time and energy than the results warrant. Too bad, but OK.
Thanks again!
Colleen