++ed by:
16 non-PAUSE users
Author image Peter Lavender
and 46 contributors


Padre::Wx::TreeCtrl - A Wx::TreeCtrl with various extra convenience methods


Padre::Wx::TreeCtrl is a direct subclass of Wx::TreeCtrl with a handful of additional methods that make life easier when writing GUI components for Padre that use trees.



  SCOPE: {
      my $lock = $tree->lock_scroll;
      # Apply changes to the tree

When making changes to Wx::TreeCtrl objects, many changes to the tree structure also include an implicit movement of the scroll position to focus on the node that was changed.

When generating changes to trees that are not the immediate focus of the user this can be extremely flickery and disconcerting, especially when generating entire large trees.

The lock_scroll method creates a guard object which combines an update lock with a record of the scroll position of the tree.

When the object is destroyed, the scroll position of the tree is returned to the original position immediately before the update lock is released.

The effect is that the tree has changed silently, with the scroll position remaining unchanged.


  my $item = $tree->GetChildByText("Foo");

The GetChildByText method is a convenience method for searching through a tree to find a specific item based on the item text of the child.

It returns the item ID of the first node containing the search text or undef if no element in the tree contains the search text.


  my @data = $tree->GetChildrenPlData;

The GetChildrenPlData method fetches a list of Perl data elements (via GetPlData) for all nodes in the tree.

The list is returned based on a depth-first top-down node order.


  my @data = $tree->GetExpandedPlData;

The GetExpandedPlData method is a variation of the GetChildrenPlData method. It returns a list of Perl data elements in depth-first top-down node order, but only for nodes which are expanded (via IsExpanded).


Copyright 2008-2013 The Padre development team as listed in Padre.pm.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.

The full text of the license can be found in the LICENSE file included with this module.