use strict; use Tk; my $mw = tkinit; my $t = $mw->Scrolled( 'Text', -scrollbars => 'se', -wrap => 'none', -width => 10, -height => 10 )->pack( -side => 'right' ); $t->insert( '0.0', "yo ho ho and a bottle of rum yo ho ho and a bottle of rum yo ho ho and a bottle of rum yo ho ho and a bottle of rum yo ho ho and a bottle of rum yo ho ho and a bottle of rum" ); # uncomment if you wnat to see "yo ho ho" $t->xview( moveto => 1 ); my $dt = $mw->Scrolled( 'DirTree', -scrollbars => 'se', ) ->pack( -expand => 1, -fill => 'both', -side => 'top' ); # this one has no effect # unless you update first # $dt->update; $dt->xview( moveto => 1 ); $mw->Button( # always works -text => "move it (this works)", -command => sub { $dt->xview( moveto => 1 ); } )->pack; MainLoop;