Re: Scrolling a window

[email protected] (Jeff Hobbs)
Newsgroups perl.tcltk
Message-ID <[email protected]>
BWidget ScrollableFrame
http://docs.activestate.com/activetcl/8.5/bwidget/ScrollableFrame.html

Example rewritten to use grid.

use strict;
use Tkx;
Tkx::package_require("BWidget");

my $mw = Tkx::widget->new(".");
my $sw = $mw->new_ScrolledWindow();
my $sf = $sw->new_ScrollableFrame();

$sw->setwidget($sf);
#$sw->g_pack(-fill => "both", -expand => 1);
$sw->g_grid(-sticky => "nsew");
# In Tk 8.4, you must use '0' instead of $sw below. Tk 8.5 will find
# the row/col based on widget reference
Tkx::grid(rowconfigure => $mw, $sw, -weight => 1);
Tkx::grid(columnconfigure => $mw, $sw, -weight => 1);

my $subf = Tkx::widget->new($sf->getframe());

my $b;
for my $i (1..20) {
     for my $j (1..20) {
	$b = $subf->new_ttk__button(-text => "$i,$j",
				    -command => sub {exit;});
	$b->g_grid(-row => $i, -column => $j);
     }
}

Tkx::MainLoop;

Enjoy,

Jeff
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.