cypress has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

The following snippit

my $tree = $mw -> new_ttk__treeview; $tree -> heading ( "#1", -command => \&resort (\$sortflag, \@item) );

returns a 'Column #1 out of range' error message. (I can try #0, or just plain 0, or 1, with the same result.)

The relevant documentation at www.tcl.tk/man/tcl8.5/TkCmd/ttk_treeview.htm reads:

pathname heading column ?-option ?value -option value...?

Query or modify the heading options for the specified column. Valid options are: ...

-command script

Use pathname heading #0 to configure the tree column heading.

And near the very bottom of the above documentation page, there's also a helpful bit on 'COLUMN IDENTIFIERS.'

I just haven't gotten the syntax right yet. Any help? Thanks.

--Cypress

Replies are listed 'Best First'.
Re: Tkx's treeview syntax question
by Anonymous Monk on Sep 28, 2009 at 20:15 UTC
    Well, you really need to refresh the syntax stuff. You cannot pass function parameters with the coderef. Your command should be something like:
    -command => sub { resort (\$sortflag, \@item) ; }
    I haven't used Tkx much, but I'm sure the rest of it should be something like this:
    $tree -> configure(heading => "#1", -command => sub { resort (\$sortfl +ag, \@item) ; } );
Re: Tkx's treeview syntax question
by Anonymous Monk on Sep 29, 2009 at 01:51 UTC