insert / edit item in customtreectrl ?
Larry Bates
larry.bates at websafe.com
Wed Nov 7 17:22:41 PST 2007
Stef Mientki wrote:
> hello,
>
> I've 3 questions (at least for now ;-) about customtreectrl:
>
> 1. How do I insert an tree-item ?
> # item is the selected item of the tree
> parent = item.GetParent()
> self.Tree.DoInsertItem ( parent.GetId() , item, 'Ins' )
> Now this doesn't work, because tree items don't have an ID.
>
> self.Tree.DoInsertItem ( parent , item, 'Ins' )
> This gives an error: GenericTreeItem instance has no attribute '__int__'
>
> 2. How do I edit labels
> I've set CT.TR_EDIT_LABELS,
> I can edit the labels,
> but pressing ENTER (on windows) doesn't close the editor.
> Clicking somewhere else closes the window, but removes my changes :-(
> In the GREAT wxPython demo this isn't working either.
>
> 3. In the wxPython demo I saw a multiline treeitem, Great !!
> How can I edit a newline in the edit mode ?
>
> thanks,
> Stef Mientki
I can help with the first one:
1. How do I insert an tree-item ?
# item is the selected item of the tree
parent = item.GetParent()
self.Tree.DoInsertItem ( parent.GetId() , item, 'Ins' )
Now this doesn't work, because tree items don't have an ID.
root=self.TC.AddRoot('WebSafe Logs', -1, -1)
treeItem=self.Tree.AppendItem(root, 'Ins')
-Larry
More information about the wxpython-users
mailing list