Draw a tree Topic is solved
Draw a tree
Hello, I have a code in c++ which builds a tree structure (it is a forest in fact because the tree has several roots). I need to draw the tree ( using rectangles for each list with the number stored in the list placed in the middle of the rectangle + lines ). I dont know how to do it. Where to place a rectangle according to the data the c++ code has evaluated ( if it is a parent, child or sibling). How to put a number from the code in the middle of the rectangle. Could someone please help me?
He's saying that he wants a number inside the expansion box instead of the default +. I don't think this is possible because it's a native widget and isn't designed for that. You need to draw all of that yourself I think.
Like this right: Instead of
You want:
Like this right: Instead of
Code: Select all
+ root
+ stuff
One
Two
Three
+ More Stuff
One
Code: Select all
2 root
3 stuff
One
Two
Three
1 More Stuff
One
Hi!
There is no such class/control in wxWidgets.
However, in the 2.4 branch there used to be wxTreeLayout. I salvaged this class from the SVN repo and hacked a small application that basically does what you want. It sure looks ugly and only resembles the sample app for wxTreeLayout that came with 2.4, plus the drawing of the bounding boxes. But maybe this gives you an idea of how you might get it done. Again: This is VERY simple.
Have a look at http://sourceforge.net/projects/wxsf/. wxShapeFramework might be what you want.
There is no such class/control in wxWidgets.
However, in the 2.4 branch there used to be wxTreeLayout. I salvaged this class from the SVN repo and hacked a small application that basically does what you want. It sure looks ugly and only resembles the sample app for wxTreeLayout that came with 2.4, plus the drawing of the bounding boxes. But maybe this gives you an idea of how you might get it done. Again: This is VERY simple.
Have a look at http://sourceforge.net/projects/wxsf/. wxShapeFramework might be what you want.
- Attachments
-
- treelayout.tar.gz
- wxTreeLayout from 2.4 branch + simple example
- (3.94 KiB) Downloaded 117 times
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
Thanks a lot.upCASE wrote:Hi!
There is no such class/control in wxWidgets.
However, in the 2.4 branch there used to be wxTreeLayout. I salvaged this class from the SVN repo and hacked a small application that basically does what you want. It sure looks ugly and only resembles the sample app for wxTreeLayout that came with 2.4, plus the drawing of the bounding boxes. But maybe this gives you an idea of how you might get it done. Again: This is VERY simple.
Have a look at http://sourceforge.net/projects/wxsf/. wxShapeFramework might be what you want.