Hi Jeff, That's it, thanks! Yes, I wanted the scrollbars on the window, which in my case has 20 label widgets, 12 text widgets, 3 radio buttons, 8 buttons, a list box, 3 combo boxes, and an image file. Sounds like too much on a screen, but it all makes sense to the users, although I'm thinking of making either a wizard type screen or use tabs. It was all in Tk and I'm trying to convert it to Tkx and have had problems with drag and drop which was solved and now scrolling the main window, which is now solved. So, thanks! Being able to change the background color of an entry widget is next, in a different thread.
Another thing I've noticed in Tkx. When I try example scripts, like the one you sent, things like "new_ttk__button" does not work correctly. I get an error like "invalid command name "ttk::button" at D:\dss\perl\tk\tkx\scroll6.pl line 19.". I can either change it from "new_ttk__button" to "new_button" or I can add "Tkx::package_require("tile")". Maybe my version is old? David -----Original Message----- From: Jeff Hobbs [mailto:je...@activestate.com] Sent: Tuesday, March 02, 2010 2:23 PM To: Swingle David-QWHM86 Cc: tcltk@perl.org Subject: Re: Scrolling a window Hi David, On 01/03/2010 2:37 PM, Swingle David-QWHM86 wrote: > Hi, I'd like to scroll a window, but can't seem to get it work. I've > seen and tried code that scrolls widgets such as a listbox, but I want > to scroll the entire window. What I would prefer is that there be no > scroll bars unless the user shrinks the window size so that widgets > are now out of view. First, I tried to associate the scrollbars with > a frame, but I would get errors. So, I tried using a canvas instead. > The code I have is below. It will display scrollbars that do nothing. I'm going to answer this from scratch again because the coffee hadn't kicked in the first time around and my answer was off. For the lurking public, the scrolledwindow references ease the attaching and managing of auto-displaying scrollbars on scrollable windows. It is part of what you (David) are actually looking for - the scrollable frame. BWidget ScrollableFrame http://docs.activestate.com/activetcl/8.5/bwidget/ScrollableFrame.html This is the canvas-based widget which provides a way to scroll a collection of any other widgets as if in a frame. You would wrap a ScrollableFrame in a ScrolledWindow for full effect, with a Tcl-based example at: http://wiki.tcl.tk/1091 or http://wiki.tcl.tk/9924 converted to Tkx would be: use strict; use Tkx; Tkx::package_require("BWidget"); my $mw = Tkx::widget->new("."); my $sw = $mw->new_ScrolledWindow(); my $sf = $sw->new_ScrollableFrame(); $sw->g_pack(-fill => "both", -expand => 1); $sw->setwidget($sf); # This is the one tricky conversion. We are getting a widget ref # back from Tcl that has never been seen as a widget in Tkx, thus # the Tkx::widget call makes the right kind of object. 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