Re: wxTreeCtrl InsertItem Method

James Lynes <[email protected]>
Newsgroups gmane.comp.lang.perl.wxperl
Message-ID <CABPysejFkxuiLkpFUhXuU-J1W3qaHy1zah+s02Mbv+6Te3Htow@mail.gmail.com>
Steve:

InsertItemBef works.

I couldn't find a method that returns an item's position under a node, so I
wrote a sub to loop through all the children of a node and calculate the
index(get_item_index). Surprised this function wasn't in wxWidgets.

AppendItem is also useful as it has two behaviours.
   1. Appending to a node adds a new item to the node in the last position.
   2. Appending to a leaf, creates a new item in a level below the leaf.

I agree that it's better if the implementation matches the wxWidgets docs
since that's all we have.

I've read the XS stuff on the wiki and I don't know enough to understand it
yet.

Thanks for the help.

James


On Wed, Nov 5, 2014 at 12:50 PM, Steve Cookson <[email protected]>
wrote:

> Hi James,
>
> On 05/11/14 17:14, James Lynes wrote:
>
>> I assume that you were looking in TreeCtrl.xs(I'm starting to see
>> how/where things are done!)
>>
> Yes.
>
>>
>> I see that InsertItemPrev needs two item pointers while InsertItemBef
>> uses one pointer and one index.
>>
>> I'll give InsertItemBef a try, it's not in the wxWidgets docs. I guess
>> wxPerl needs unique names for alternate constructers?
>>
> Not necessarily, although that is the easiest.  It's clearly best if the
> wxPerl implementation follows the wxWidgets documentation.
>
> Where wxWidgets uses overloaded methods there are ways of mimicking that,
> but I'm not familiar with it.  I should probably look on the wiki, as Mark
> spent some time documenting it there.
>
> Regards
>
> Steve.
>
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.