RE: Scrolling a window

[email protected] ("Swingle David-QWHM86")
Newsgroups perl.tcltk
Message-ID <[email protected]>
Oh, that works.  Thanks!  I must have had it wrong, but that was several
edit cycles ago so I can't see what I had :)

-----Original Message-----
From: Jeff Hobbs [mailto:[email protected]] 
Sent: Tuesday, March 02, 2010 6:25 PM
To: Swingle David-QWHM86
Cc: [email protected]
Subject: Re: Scrolling a window

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.