itemcoloring listview 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
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

itemcoloring listview

Post by Wolfgang »

Hello

I tried a wxcombopopup with a listview
everything works fine.
Now I tried to colour a item, also it does not show an error it also does not work either

Code: Select all

 
 wxString strcolor = "3366FF";

    wxColour ncol, acol, nocol;
    ncol.Set("#" + strcolor);
        iface_bun->SetItemTextColour(count - 1, ncol);
        
Last edited by Wolfgang on Thu Oct 10, 2019 4:02 pm, edited 1 time in total.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: itemcolorin listview

Post by PB »

This works only in the report view (wxLC_REPORT), are you using it?
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: itemcolorin listview

Post by Wolfgang »

No, reportview did not work, with it. Just caused problems.

Is there any way that some of the items, have other colours?

Or only in with wxLC_REPORT?
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: itemcoloring listview

Post by Wolfgang »

Ok, managed the report view, but is it somehow possible to set item 1 column 1 on black colour and item 1 column 2 on blue, and then item 2 column1 on green and then item 2 column 2 on red?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: itemcoloring listview

Post by PB »

This thread shows how to colour individual items (MSW only, the best version of the code is in the last post), was it of no help?
viewtopic.php?f=1&t=46088&p=192585
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: itemcoloring listview

Post by ONEEYEMAN »

Hi,
What kind of problems? Can you be more descriptive?
Also - what platform are you testing it under?

Thank you.
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: itemcoloring listview

Post by Wolfgang »

ONEEYEMAN wrote: Thu Oct 10, 2019 9:00 pm Hi,
What kind of problems? Can you be more descriptive?
Also - what platform are you testing it under?

Thank you.
Solved the first problems I had with reportview, but not the colouring problem, will check the link now.
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: itemcoloring listview

Post by Wolfgang »

The solution of the link is ok, but only working for mSW.

What I really need, colouring of items in different colours. I have only one set of items, so more colums are only neccessary for better view, and not because my data comes of more colums.

So in fact I have for example the numbers 1 to 70 all above 40 should be in a different colour. some of the whole numbers should be in a other colour.
And The 70 numbers should be splitted into two or more colums.

With reportview and item colouring everyhting works fine, but there I cannot split it into more colums, it is just one very long column. But all 70 shuld be seen at once.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: itemcoloring listview

Post by PB »

As I told you before, I do not think you can have this with wxListCtrl.

You either need to create your own control; or, if you do not mind that it looks a bit odd AND does not have keyboard support etc., you could try displaying the items using wxHtmlWindow instead of wxListCtrl, laying the items with e.g. <table> and handling EVT_HTML_CELL_CLICKED/HOVER. I am not saying this could work, just an idea that came to my mind and should not be difficult to test...
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: itemcoloring listview

Post by Wolfgang »

htmlwindow could work, but I had already an idea with making my own listview on a sizer on a panel for it, meaning a reportview,and if more than 30 items,it will create another listview beside the previous on the same sizer. Should work. But is most likely the difficult part.
Post Reply