[wxPython-users] Re: insert / edit item in customtreectrl ?

Rickey, Kyle W Kyle.Rickey at bakerhughes.com
Thu Nov 8 09:06:37 PST 2007


Try this:

child = self.tree.InsertItem(parent, prev_sibling, "Test insert",
image=self.image, selImage=self.image)

where prev_sibling is the item you want to insert after.

-Kyle Rickey

-----Original Message-----
From: Stef Mientki [mailto:s.mientki at ru.nl] 
Sent: Thursday, November 08, 2007 10:56 AM
To: wxPython-users at lists.wxwidgets.org
Subject: Re: [wxPython-users] Re: insert / edit item in customtreectrl ?



Larry Bates wrote:
> 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')
thanks Larry,
Yes, I don't have trouble with append,
but I want to insert :-(

cheers,
Stef



Het UMC St Radboud staat geregistreerd bij de Kamer van Koophandel in
het handelsregister onder nummer 41055629.
The Radboud University Nijmegen Medical Centre is listed in the
Commercial Register of the Chamber of Commerce under file number
41055629.



---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org




More information about the wxpython-users mailing list