Wx::Perl::VirtualTreeCtrl

Build a tree control on demand
Download

Wx::Perl::VirtualTreeCtrl Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • BBC
  • Publisher web site:
  • http://www.bbc.co.uk

Wx::Perl::VirtualTreeCtrl Tags


Wx::Perl::VirtualTreeCtrl Description

Build a tree control on demand Wx::Perl::VirtualTreeCtrl is a Perl module that implements a tree like the Wx::TreeCtrl except that it populates its items dynamically when nodes in the tree are expanded. You may prefer this control over the standard tree control when you are populating your tree from a remote source such as a database, or when your tree is very large.This module implements the same interface as a standard Wx::TreeCtrl.SYNOPSIS use Wx::Perl::VirtualTreeCtrl 'EVT_POPULATE_TREE_ITEM'; my $tree = new Wx::Perl::VirtualTreeCtrl($tree_ctrl); EVT_POPULATE_TREE_ITEM($self, $tree, &AddChildren); my $root = $tree->AddRoot($name, $data); $tree->Expand($root); sub AddChildren { my ($self, $event) = @_; my $tree = $event->GetEventObject; my $item = $event->GetItem; my $item_data = $tree->GetPlData($item); if ($tree->GetChildrenCount($item, 0)) { # update existing children ... my ($child, $cookie) = $tree->GetFirstChild($item); while ($child && $child->IsOk) { my $child_data = $tree->GetPlData($child); # synchronise deletions if (child_was_deleted($child_data)) { $tree->Delete($child); } ($child, $cookie) = $tree->GetNextChild($child, $cookie); } } else { # add children for the first time my @child_data = expensive_process_to_get_children($item_data); foreach (@child_data) { my $child = $tree->AppendItem($item, $_->{name}); # make item expandable if it's a folder $tree->SetItemHasChildren($child, 1) if ...; } } } Requirements: · Perl


Wx::Perl::VirtualTreeCtrl Related Software