Re: wxTreeCtrl InsertItem Method

Steve Cookson <[email protected]>
Newsgroups gmane.comp.lang.perl.wxperl
Message-ID <[email protected]>
Hi James,

It looks a bit complicated.  I'm not a user of TreeCtrl.

On 05/11/14 14:03, James Lynes wrote:
> Good Day All:
>
> I'd like to use the wxTreeCtrl InsertItem method.
>
> 1.   I tried calling it and got a loading error which unfortunately I 
> didn't copy down the exact wording. Is this method wrapped?
It looks half wrapped.  I think someone started but didn't get around to 
finishing it.  It uses an overloaded method in C++, which is a bit more 
complex to wrap than normal.

If you look at the two methods (InsertItem 
<http://docs.wxwidgets.org/trunk/classwx_tree_ctrl.html#a06e1e6b25a7121922412eea510bd3109>), 
it looks to me as though the second would be the most intuitive. 
"Insert" normally means insert before.  In that case it might not be too 
hard to complete that wrapping only and avoid the overload situation.  
They could even have two names InsertItemBefore InsertItemAfter.  
However the documentation would be inconsistent.

I think the correct answer for now, where nothing works, is to wrap one.
>
> 2.    Also, to insert an Item, you need an empty Item to insert.
It looks like it just accepts a string, but as I said, I think the 
wrapping is incomplete.
> I found wxTreeItemId in wxCore, but the comment says it's not intended 
> to be constructed explicitly by the user. How should you make an empty 
> Item?
As above, I don't think you need to.
>
> AppendItem works as advertised, but the node is appended after the 
> last child node which is not exactly what I'd like to do. It could be 
> dragged where needed, but that adds another step.
According to the doc, Append should append to the last child of the 
parent node that you specify.  Prepend inserts before the first child of 
the specified parent node.

If it doesn't then maybe it's a wxWidgets fault.
>
> Ideas?
> Thanks,
> James
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.