Tree Problems
- From: "Sebastian Weitzel" <sebastian weitzel fh-stralsund de>
- To: <gtk-perl-list gnome org>
- Subject: Tree Problems
- Date: Wed, 11 Sep 2002 20:11:47 +0200
Hello again :)
I have a problem with writing a sub for creating tree entries
Here's the code:
sub create_tree {
my ($form,$parent,$text,$subtree,$expand,$id) = @_;
# If item not already has a subtree to be appended
if ($parent != a_subtree || $parent != "") { #if true parent is a
TreeItem, so create a new subtree
my $newtree = new Gtk::Tree();
$parent->set_subtree( $newtree );
if ($expand) {
$parent->expand;
}
}
#now a subtree exists where to add the new TreeItem
my $item = new_with_label Gtk::TreeItem( $text );
#if $parent is empty a root is created (the first entry in the
tree)
if ($parent=="") {
$parent = $window->FORM->{'datatree'};
}
else $parent=$newtree;
$form->$parent->append( $item );
$item->show();
return $item,$subtree;
}
Where $form is the form in which the tree is created, $parent is either
a TreeItem or a Subtree and so on...
1. Problem: how can I find out if $parent is a TreeItem or a Subtree, to
decide if I have to create a Subtree or if I can directly append the new
TreeItem to $parent (an existing Subtree)
2. Problem: I want to edit or delete TreeItems and Subtrees later. So
how can I access them later, after many Items have been created? I think
of an array with all new tree entrys ($id) added. Does anybody have an
efficient idea?
Please help me,
Sebastian Weitzel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]