How to change wxListCtrl selected item appearance?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Tapsa
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

How to change wxListCtrl selected item appearance?

Post by Tapsa »

I tried using

Code: Select all

virtual wxListItemAttr* OnGetItemAttr(long item) const;
that returns pointer to my

Code: Select all

wxListItemAttr(*wxWHITE, *wxCYAN, *wxNORMAL_FONT);
but it seems to affect only the items that are not selected.
I want to change the selected item background to be always blue, not only when the list has focus on it.
How can I know if the item is selected or not? Do I need to keep track of that myself?
It would be nice to get rid of that dotted rectangle of focused item too or make it appear always (now it appears randomly).
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to change wxListCtrl selected item appearance?

Post by doublemax »

I want to change the selected item background to be always blue, not only when the list has focus on it.
Not possible with the underlying native control. I'm pretty sure about this, because i spent quite some time myself trying to do the same.
It would be nice to get rid of that dotted rectangle of focused item too or make it appear always (now it appears randomly).
I'm not 100% sure about this, but my guess is that it's not possible either.

You'll have to switch to a generic control like wxDataViewCtrl or wxGrid where you have more control over the visuals.
Use the source, Luke!
Tapsa
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Re: How to change wxListCtrl selected item appearance?

Post by Tapsa »

All right.
Post Reply