Dynamically resizing wxTreeCtrl label lengths 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
RealityMage
Experienced Solver
Experienced Solver
Posts: 75
Joined: Tue Aug 23, 2005 3:47 am

Dynamically resizing wxTreeCtrl label lengths

Post by RealityMage » Thu Jun 08, 2006 4:31 am

In other programs (Gaim, Psi), I see that when I resize a window with a textctrl, long labels are shortened and displayed truncated with an elipsis (...) at the end.

How can I achieve a similar effect with wxWidgets' wxTreeCtrl.

lowjoel
Moderator
Moderator
Posts: 1511
Joined: Sun Jun 19, 2005 11:37 am
Location: Singapore
Contact:

Post by lowjoel » Fri Jun 09, 2006 12:31 am

Use wxWindow::GetTextExtent and shorten the string until you get one of desirable length... and then set the label to be of that length? Im not too sure

RealityMage
Experienced Solver
Experienced Solver
Posts: 75
Joined: Tue Aug 23, 2005 3:47 am

Post by RealityMage » Fri Jun 09, 2006 1:10 am

Problem is that the label is drawn indented because of the TreeCtrl indenting.

Cursor
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France
Contact:

Post by Cursor » Fri Jun 09, 2006 6:36 am

You can retrieve the item rectangle (including position) with wxTreeCtrl::GetBoundingRect [1].

[1] : http://www.wxwidgets.org/manuals/2.6.3/ ... etitemrect
What is little and green, witch go up and down ??
Yoda playing with the force.

Post Reply