Re: Scrolling a window
[email protected] (Jeff Hobbs)
| Newsgroups | perl.tcltk |
|---|---|
| Message-ID | <[email protected]> |
GUI.pm has several examples, just look for the code I mentioned. I'd only be cutting/pasting that code. On 02/03/2010 10:31 AM, Swingle David-QWHM86 wrote: > Thanks! Is there help on how to use widget::scrolledwindow and/or > examples that use it, or do I have to go thru GUI.pm and figure it out? > David > > -----Original Message----- > From: Jeff Hobbs [mailto:[email protected]] > Sent: Tuesday, March 02, 2010 1:17 PM > To: Swingle David-QWHM86 > Cc: [email protected] > 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. > > In order to scroll a set of widgets (rather than a single widget > designed for scrolling), you need to use a megawidget that actually > places the items on a canvas (which has a viewport for handling this). > Fortunately this case is common enough that there are a couple in the > tkkit. > > The first is the BWidget ScrolledWindow. You can find an example of > that in the tkx-ed code that ships with ActivePerl (look for > 'new_ScrolledWindow'). > > The second (and my preferred) is package 'widget::scrolledwindow', with > an example in ActivePerl's lib/ActivePerl/PPM/GUI.pm (look for > 'new_widget__scrolledwindow'). > > Indeed, the PPM GUI sources are a good source of Tkx code. We wrote the > UI entirely in Tkx, just leveraging code in tkkit. It has examples for > cross-platform considerations, improved styling with use of native > themed widgets, and advanced widget use cases. > > Regards, > > Jeff