How to change style of wxTreeListCtrl collapsers?

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
buttonsrtoys
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon Jul 03, 2017 12:03 am

How to change style of wxTreeListCtrl collapsers?

Post by buttonsrtoys » Fri Jul 20, 2018 5:16 pm

Don't know the term for "collapsers" but I'm referring to these things:
wxTreeListCtrl.JPG
wxTreeListCtrl.JPG (18.41 KiB) Viewed 660 times
They're not displaying well for me. In the image, the ">" is lighter and proportionately different than the darker "v". Also, on one of our machines, it appears a bit mangled:
wxTreeListCtrl2.JPG
wxTreeListCtrl2.JPG (9.92 KiB) Viewed 660 times
I played with some settings but couldn't find how to change their look. Here's my lines for adding them:

Code: Select all

m_TreeListCtrl = new wxTreeListCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 300), wxTL_DEFAULT_STYLE | wxTL_3STATE | wxTL_NO_HEADER);
m_TreeListCtrl->AppendColumn(wxEmptyString, wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT, wxCOL_RESIZABLE | wxCOL_SORTABLE);
I'd be open to change their style to "[+]" and "[-]" if it fixed the problem.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3464
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How to change style of wxTreeListCtrl collapsers?

Post by ONEEYEMAN » Fri Jul 20, 2018 5:30 pm

Hi,
What is your wx version?
What is your OS?
Which toolkit you are using (if applicable)?

Thank you.

buttonsrtoys
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon Jul 03, 2017 12:03 am

Re: How to change style of wxTreeListCtrl collapsers?

Post by buttonsrtoys » Fri Jul 20, 2018 6:18 pm

Sorry. Wx 3.1.1, Windows 10.

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

Re: How to change style of wxTreeListCtrl collapsers?

Post by doublemax » Fri Jul 20, 2018 6:55 pm

Under Windows you should see the [+] [-] by default.
I played with some settings but couldn't find how to change their look. Here's my lines for adding them:
What do you mean by "adding them"? They appear on their own.

It seems like there is some important information missing. Please tell us exactly what you did, ideally with some code.
Use the source, Luke!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3464
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How to change style of wxTreeListCtrl collapsers?

Post by ONEEYEMAN » Fri Jul 20, 2018 7:02 pm

Hi,
Can you reproduce the behaviour in the sample (probably dataview one)? Or whatever has the wxTreeListCtrl?

Thank you.

buttonsrtoys
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon Jul 03, 2017 12:03 am

Re: How to change style of wxTreeListCtrl collapsers?

Post by buttonsrtoys » Mon Jul 23, 2018 12:06 pm

Thanks for the thoughts, guys. On one-eye's suggestion, I built one of the samples (samples/treelist) and below is the result. It has the arrows (instead of the [+] and [-]) and the down arrow is darker then the right arrow (to my eye) though not squished like what I'm seeing in my app.
wxTreeListCtrl3.JPG
wxTreeListCtrl3.JPG (39.08 KiB) Viewed 592 times

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

Re: How to change style of wxTreeListCtrl collapsers?

Post by doublemax » Mon Jul 23, 2018 1:36 pm

Sorry, i checked the treectrl sample, not treelist (must be the heat). In the treelist sample i see the same as you.

wxDataViewCtrl uses this line to draw the icon:

Code: Select all

wxRendererNative::Get().DrawTreeItemButton( this, dc, rect, flag);
Which means that it can only be changed by using a custom renderer or by modifying the wxDataViewCtrl source.
http://docs.wxwidgets.org/trunk/classwx ... ative.html
Use the source, Luke!

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2057
Joined: Sun Jan 03, 2010 5:45 pm

Re: How to change style of wxTreeListCtrl collapsers?

Post by PB » Mon Jul 23, 2018 2:14 pm

Is there actually an issue?

wxWidgets try to be as native as possible and what is displayed in the sample is what the OS uses for the tree control? This is folderview from Explorer on W10
treeview.png
treeview.png (6.45 KiB) Viewed 582 times
The only difference I could spot is that Explorer hides those "expanders" when the control loses its focus which I personally detest (just like MS Word hiding scrollbars).

Perhaps the deformation of arrows in your app is somewhat related to using those checkboxes...

Edit No deformation of expanders in the sample even with checkboxes shown
treeviewchk.png
treeviewchk.png (4.64 KiB) Viewed 555 times
The screenshot in the OP from the PC where it is "mangled" - the PC does run on Windows 10, right? The checkmarks look different there.

buttonsrtoys
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon Jul 03, 2017 12:03 am

Re: How to change style of wxTreeListCtrl collapsers?

Post by buttonsrtoys » Mon Jul 23, 2018 6:55 pm

I'm OK with the arrows (>,V) instead of the boxes ([+],[-]). I just need to fix the mangling. (All the machines are Windows 10).

I'll post my code, but there's a fair amount of logic intermixed. I'll trim it down and post.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2057
Joined: Sun Jan 03, 2010 5:45 pm

Re: How to change style of wxTreeListCtrl collapsers?

Post by PB » Mon Jul 23, 2018 7:13 pm

buttonsrtoys wrote:I just need to fix the mangling. (All the machines are Windows 10).
In that one screenshot (wxTreeListCtrl2.jpg) it is clearly discernible that the GUI looks different. Not only the checkmarks but the folder icons as well.

Looks like Windows older than 10 to me (7 or 8 ?), see e.g.
Image

Post Reply