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
Earned some good credits
Earned some good credits
Posts: 121
Joined: Mon Jan 28, 2019 8:22 am

itemcoloring listview

Post by Wolfgang » Thu Oct 10, 2019 12:19 pm

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: 2057
Joined: Sun Jan 03, 2010 5:45 pm

Re: itemcolorin listview

Post by PB » Thu Oct 10, 2019 2:14 pm

This works only in the report view (wxLC_REPORT), are you using it?

Wolfgang
Earned some good credits
Earned some good credits
Posts: 121
Joined: Mon Jan 28, 2019 8:22 am

Re: itemcolorin listview

Post by Wolfgang » Thu Oct 10, 2019 3:17 pm

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
Earned some good credits
Earned some good credits
Posts: 121
Joined: Mon Jan 28, 2019 8:22 am

Re: itemcoloring listview

Post by Wolfgang » Thu Oct 10, 2019 6:24 pm

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: 2057
Joined: Sun Jan 03, 2010 5:45 pm

Re: itemcoloring listview

Post by PB » Thu Oct 10, 2019 6:57 pm

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: 3464
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: itemcoloring listview

Post by ONEEYEMAN » 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.

Wolfgang
Earned some good credits
Earned some good credits
Posts: 121
Joined: Mon Jan 28, 2019 8:22 am

Re: itemcoloring listview

Post by Wolfgang » Fri Oct 11, 2019 5:55 am

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
Earned some good credits
Earned some good credits
Posts: 121
Joined: Mon Jan 28, 2019 8:22 am

Re: itemcoloring listview

Post by Wolfgang » Fri Oct 11, 2019 6:04 am

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: 2057
Joined: Sun Jan 03, 2010 5:45 pm

Re: itemcoloring listview

Post by PB » Fri Oct 11, 2019 6:51 am

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
Earned some good credits
Earned some good credits
Posts: 121
Joined: Mon Jan 28, 2019 8:22 am

Re: itemcoloring listview

Post by Wolfgang » Fri Oct 11, 2019 9:56 am

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