in reply to Scrolled Tree scrollbar xview problem

Hi, without seeing your full working example I couldn't answer to your specific code, but here is a working example to show you a trick with a Scrolled Tree. Notice that scrolling will not work until the mainloop starts and the widget is visible. The work-around is to use an $widget->update. Also notice that the setting range is between 0 and 1.I hope it helps.
#!/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;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Scrolled Tree scrollbar xview problem
by LanX (Saint) on Mar 18, 2017 at 11:08 UTC