I’m sure there must be some simple setting (or trick) I’m not aware of for treectrls and customtreectrl that will allow only the children to be multi-selection. IOW I do NOT want all of the treectrl parents to have multi-selection only the children. Currently, without setting the entire treectrl to (wx.TR_MULTIPLE) the selections of children of a node will act like a radio button.
There is no setting to allow that, but it should be quite easy to add
it. Add a SetChildrenSelectMultiple function to a tree item, and have
it loop through its children setting a select multiple flag. Then
search the code for TR_MULTIPLE and add a check for the select
multiple flag to allow multi selecting that item when TR_MULTIPLE is
not set.
If you have a good IDE with a code outline like eclipse has it is easy
to confirm this by opening customtreectrl.py and quickly browsing the
code.
Mark
···
On May 2, 12:07 am, John Fabiani <fabiani.j...@gmail.com> wrote:
I'm sure there must be some simple setting (or trick) I'm not aware of for
treectrls and customtreectrl that will allow only the children to be
multi-selection. IOW I do NOT want all of the treectrl parents to have
multi-selection only the children. Currently, without setting the entire
treectrl to (wx.TR_MULTIPLE) the selections of children of a node will act
like a radio button.
Thanks in advance,
Johnf
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visithttp://groups.google.com/group/wxPython-users?hl=en
Thanks Mark I'll look into creating a custom class of the treectrl or customtreectrl.
Its much easier to instead just bind to EVT_TREE_SEL_CHANGING, then in the event handler veto the event if the TreeItem has children nodes. That will allow you to control what nodes can be selected.
Thanks Cody, you just gave me a way to handle something else I was
doing.
···
On May 2, 10:39 pm, Cody Precord <codyprec...@gmail.com> wrote:
Hi,
On May 2, 2010, at 9:21 AM, John Fabiani wrote:
> Thanks Mark I'll look into creating a custom class of the treectrl
> or customtreectrl.
Its much easier to instead just bind to EVT_TREE_SEL_CHANGING, then in
the event handler veto the event if the TreeItem has children nodes.
That will allow you to control what nodes can be selected.
Cody
treetest.py
< 1KViewDownload
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visithttp://groups.google.com/group/wxPython-users?hl=en
Thanks this does in fact look easier - but what about the customTreeCtrl with the check marks etc… IOW would this still work with yoiu blocking the evt?
Johnf
Thanks Mark I’ll look into creating a custom class of the treectrl or customtreectrl.
Its much easier to instead just bind to EVT_TREE_SEL_CHANGING, then in the event handler veto the event if the TreeItem has children nodes. That will allow you to control what nodes can be selected.
On Mon, May 3, 2010 at 9:59 AM, John Fabiani <fabiani.john@gmail.com> wrote:
Thanks this does in fact look easier - but what about the customTreeCtrl
with the check marks etc... IOW would this still work with yoiu blocking
the evt?
It should, easiest way would be to try it out and find out for yourself.