Change the look of wxListCtrl Topic is solved

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
extreme001
I live to help wx-kind
I live to help wx-kind
Posts: 192
Joined: Fri Dec 22, 2006 9:17 am
Location: Germany
Contact:

Change the look of wxListCtrl

Post by extreme001 » Thu Jan 29, 2009 3:38 pm

Hi!

As i'm coming from mfc i know there is a way to change to look&feel of a listcontrol and want to do it in wx for all platforms. I checked the wxRendererNative class and the sample "render" in the samples directory but i'm more confused than ever and need help with it, please.

I want to change the height of the columnheader and also the backgroundcolor and the textcolor of the columnheader. Is it possible with wx or must i create an own control.

Here is an example:

http://www.holdemmanager.net/images/scr ... _large.jpg

Hope to get helped.

Thank you!

JimFairway
wxWorld Domination!
wxWorld Domination!
Posts: 1059
Joined: Sun Dec 30, 2007 6:40 pm
Location: Canada

Post by JimFairway » Thu Jan 29, 2009 5:40 pm

Hi,

Which part of the screenshot would you like to use wxListCtrl for?
For the main section with the players, etc., I would be inclined to use wxGrid, it allows you to render whatever you would like in each cell.

See http://docs.wxwidgets.org/stable/wx_wxgrid.html#wxgrid and also the sample in your samples folder.

Hope that helps,

Jim
OS: Vista SP1, wxWidgets 2.8.7.

extreme001
I live to help wx-kind
I live to help wx-kind
Posts: 192
Joined: Fri Dec 22, 2006 9:17 am
Location: Germany
Contact:

Post by extreme001 » Thu Jan 29, 2009 10:03 pm

It should look like one in player summary. With headers and footers if possible. Data should be sorted, too. I think sorting is a feature which is not available in a wxGrid...or am i wrong?

Can i change the color of the columnheader in a grid?

And is it possible to find out if a columnheader was clicked?

Thank s for your help so far :-)

timg
Earned some good credits
Earned some good credits
Posts: 148
Joined: Mon Jan 23, 2006 6:52 pm

Post by timg » Thu Jan 29, 2009 10:15 pm

extreme001 wrote:It should look like one in player summary. With headers and footers if possible. Data should be sorted, too. I think sorting is a feature which is not available in a wxGrid...or am i wrong?
Yes, I believe you would need to implement any sorting on your own.
extreme001 wrote:Can i change the color of the columnheader in a grid?
Yes, you can change the label background color, text color and font.
extreme001 wrote:And is it possible to find out if a columnheader was clicked?

Thank s for your help so far :-)
There are events for label clicks.

JimFairway
wxWorld Domination!
wxWorld Domination!
Posts: 1059
Joined: Sun Dec 30, 2007 6:40 pm
Location: Canada

Post by JimFairway » Thu Jan 29, 2009 10:56 pm

Hi,

My understanding is that the background color needs to be the same for all column labels, i.e. you can't have a different color for each column label.

As Tim points out, you can do your own sorting. Depending on how your data is stored, it can be quite straight forward.
You could use wxArrayPtrVoid to store the data or use STL list. Both support a sort function.

Hope that helps,

Jim
OS: Vista SP1, wxWidgets 2.8.7.

extreme001
I live to help wx-kind
I live to help wx-kind
Posts: 192
Joined: Fri Dec 22, 2006 9:17 am
Location: Germany
Contact:

Post by extreme001 » Fri Jan 30, 2009 8:30 am

Ok. thank you guys.

The answer main question "Can i manipulate a wxListCtrl to change the color & size of headers?" Is NO. right?

framepointer
Super wx Problem Solver
Super wx Problem Solver
Posts: 264
Joined: Mon Aug 07, 2006 3:25 pm
Location: Baia Mare, Romania
Contact:

Post by framepointer » Fri Jan 30, 2009 10:32 am

extreme001 wrote:Ok. thank you guys.

The answer main question "Can i manipulate a wxListCtrl to change the color & size of headers?" Is NO. right?
You're right. AFAIK this cannot be achieved.

Regards
Software is like sex,
It's better when it's free.
~Linus Torvalds

User avatar
doublemax
Moderator
Moderator
Posts: 14088
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Post by doublemax » Fri Jan 30, 2009 10:43 am

one option could be to use a copy of wxGenericListCtrl and modify it to your needs. E.g. aMule did it that way.
Use the source, Luke!

Post Reply