in reply to Scrolled Tree scrollbar xview problem
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Tree; my $mw = MainWindow->new; my $tree = $mw->Scrolled('Tree')->pack(qw/-expand 1 -fill both/); foreach(1 .. 100) { $tree->add($_, -text => "Line $_"); } # you must update the tree first # before the yview works $tree->update; $tree->yview( moveto => .5 ); # or it will always work from a widget # command after the gui has visibility $mw->Button( # always works because you have visibility -text => "move it (this works)", -command => sub { $tree->yview( moveto => 1 ); } )->pack; MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Scrolled Tree scrollbar xview problem
by LanX (Saint) on Mar 18, 2017 at 11:08 UTC |