Hello, list. I’m trying to create a ComboCtrl that has as its popup a CustomTreeCtrl, and I’m having some trouble getting what I’d like to see. (WinXP, Python 2.5, wxPython 2.8.10.1).
What I would like is a ComboCtrl that pops up a rather simple-looking CustomTreeCtrl: items without a root, buttons, or lines, and with each item having a checkbox. When that checkbox is checked, the item should expand to show another item below it, which is the word “Note:” with a textCtrl to the right of it. The idea is to allow a list of items to be selected, but with the option to add a note to checked items.
Attached is a small runnable sample that shows an almost-there example, but also shows four problems I have. They are:
-
The items are displaced to the right by a noticeable amount. This is the same amount of space that would have been taken up by the buttons if they had been there. I would instead like the checkboxes to be almost flush to the left hand side of the dropdown (like a ListBox).
-
In order to have the effect where checking or unchecking a checkbox expands or collapses a node, it seems I need to include the line:
self.tree.SetItemBold(item)
(or the one that unbolds it) Why? That seems like it should be independent of Expand() or Collapse(), but if both occasions of those lines are commented out, the node doesn’t do either. I would like the option to not necessarily have the checked item turn bold.
-
I cannot type in the TextCtrl. I thought this was an issue of that I parented it to the wrong control, but I’ve tried the ComboCtrl, the popup (here, self.tcp), and the CustomTreeCtrl and only the CustomTreeCtrl works at all–but I can’t type in it/edit it.
-
When any node does Collapse(), its TextCtrl remains there, uncollapsed.
Any help is, as always, appreciated.
Also, if anyone has suggestions for achieving this same sort of GUI with a different approach, I’d love to hear them. Basically I want a nice-looking and compact way to check off a number of items and optionally add very brief notes to checked items.
Thanks,
Che
customtreectrl_sample_app.py (4.77 KB)
···
–
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en