Re: HList path question

Slaven Rezic <[email protected]> 11 Nov 2006 19:27:08 +0100
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
Bryan Beutler <[email protected]> writes:

> Hi,
> 
> I am using an HList to display database records.  I am
> using a unique, but non-sequential, key for each path
> of the HList.  Is there a way I can iterate through
> the HList to find out what the paths are? 
> 

You can use this method:

=head2 getlist

=for category Tk

    @list = $hlist->getlist;

Get a flat list of all entries in a Tk::HList widget.

This is by Marc Dashevsky (and not yet tested).

=cut

sub Tk::HList::getlist {
    my $tree = shift;
    my @ListOfAllEntries;
    my @list = $tree->infoChildren(shift);
    if (@list) {
	foreach my $entry (@list) {
	    push @ListOfAllEntries, $entry;
	    push @ListOfAllEntries, $tree->getlist($entry);
	}
    }
    @ListOfAllEntries;
}


-- 
Slaven Rezic - slaven <at> rezic <dot> de

    tkruler - Perl/Tk program for measuring screen distances
    http://ptktools.sourceforge.net/#tkruler
--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/ptk