Trees, Lists and Check Boxes

I’m looking for some assistance extending the TreeListCtrl class to
include the check box ability of the CustomTreeCtrl as well as 3-state
check boxes.

Main Column Column1


[o] Child1

-----[ ]Child1.1
-----[ ]Child1.2
-----[o]Child1.3
-----[ ]Child1.3.1 Value1
-----[ ]Child1.3.2 Value2

   >-----[  ]Child1.3.3                Value3
   >-----[X]Child1.3.4                Value4

[o] Child2

-----[ ]Child2.1
-----[ ]Child2.2
-----[ ]Child2.3
-----[o]Child2.4
-----[ ]Child2.4.1 Value1

   >-----[X]Child2.4.2                Value2
   >-----[  ]Child2.4.3                Value3
   >-----[  ]Child2.4.4                Value4

[o] Child3

-----[ ]Child3.1
-----[ ]Child3.2

-----[ ]Child3.3

-----[ ]Child3.4
-----[ ]Child3.4.1 Value1
-----[ ]Child3.4.2 Value2
-----[ ]Child3.4.3 Value3
-----[ ]Child3.4.4 Value4

Any ideas on the easiest and most effective way to do this?

Robin Dunn wrote:

P-Cubed wrote:

I'm looking for some assistance extending the TreeListCtrl class to
include the check box ability of the CustomTreeCtrl as well as 3-state
check boxes.

I think a better solution (maybe not easiest, but certainly better) would be to extend CustomTreeCtrl to be able to have multiple columns like TreeListCtrl does.

One way to do this with minimal impact on the current CustomTreeCtrl would be to use a separate widget that draws the header and the non-tree columns, and then embed a CustomTreeCtrl in the tree column. It can then hook itself to the tree's events and use the tree's methods and attributes as necessary to keep itself in sync.

Ah, I just realized that the CustomTC's scrollbars would be out of place...

Another possibility along these same lines would be to refactor CustomTreeCtrl so it can draw itself with an origin other than (0,0) and then the CustomTLC could just be a derived class that puts the CustomTC at someplace other than (0,0) (leaving room for the header, other oclumns, etc.) and handles the drawing, mouse interaction, etc. of the rest of the control itself.

... so this would be better because there would only be the one scrolled window. It's just that the CustomTC's content would be shifted and the derived class would draw and manage the rest of the space.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thursday, April 26, 2007, 11:25:29 AM, P-Cubed wrote:

I'm looking for some assistance extending the TreeListCtrl class to
include the check box ability of the CustomTreeCtrl as well as
3-state check boxes.

Main Column Column1
----------------------------------------- -------------
[o] Child1
>-----[ ]Child1.1
>-----[ ]Child1.2
>-----[o]Child1.3
      >-----[ ]Child1.3.1 Value1
      >-----[ ]Child1.3.2 Value2
      >-----[ ]Child1.3.3 Value3
      >-----Child1.3.4 Value4
[o] Child2
>-----[ ]Child2.1
>-----[ ]Child2.2
>-----[ ]Child2.3
>-----[o]Child2.4
      >-----[ ]Child2.4.1 Value1
      >-----Child2.4.2 Value2
      >-----[ ]Child2.4.3 Value3
      >-----[ ]Child2.4.4 Value4
[o] Child3
>-----[ ]Child3.1
>-----[ ]Child3.2
>-----[ ]Child3.3
>-----[ ]Child3.4
      >-----[ ]Child3.4.1 Value1
      >-----[ ]Child3.4.2 Value2
      >-----[ ]Child3.4.3 Value3
      >-----[ ]Child3.4.4 Value4

Any ideas on the easiest and most effective way to do this?

Probably this is _not_ what your looking for, since is a 'main column
only' solution, but maybe it could help you on the way to build such a
widget:

http://j.domaindlx.com/elements28/wxpython/ButtonTreeCtrlPanel.html

-- tacao

No bits were harmed during the making of this e-mail.