jdtoronto has asked for the
wisdom of the Perl Monks concerning the following question:

Esteemed monks,

I have Perl/Tk code which produces a window something like a day-timer week at a view page. Across the top I have the days of the week, down the left hand side time of day in 10 or 15 minute increments. Now comes my problem.

I have scroll bars on both X and Y axes. But when I scroll horizontally I want the days of the week to scroll with the body (the times to remain visble), but when I scroll vertically I want the days of the week to stay visible whilst the times scroll with the body.

The body of the window consists merely of a huge collection of buttons, one for each time slot for each day of the week.

Not that I've tried it — and my experience with Tk leads me to intuit that it won't work out as cleanly as it should — but it sounds to me like you want two scrollables, one inside the other. The outer scrollable would only scroll horizontally. The thing it contains (a Pane, I suppose) would contain a frame at the top, non-scrolling, and a scrollable below that which scrolls vertically.

A word spoken in Mind will reach its own level, in the objective world, by its own weight

So if the user scrolls horizontally to the "middle" of the day-of-week range, then scrolls vertically to the "middle" of the time-of-day range, both the day-of-week labels and time-of-week labels need to still be visible, right?

For that to work, I think you actually need three scrolling windows:

a "column headings" window that shows the day-of-week labels (has a height of one line), and only scrolls left-to-right;

a "row headings" window that shows the time-of-day labels (has a width of 5 characters: HH:MM), and only scrolls up-and-down;

the data grid table of 7 columns by however many rows (each cell is as big as you think necessary), and scrolls in all directions.

I don't have any specific coding examples handy, but I do remember that there's a way to set up callbacks on the scrollbars for a given scrolling window. The idea is that the scrollbars for the grid window will invoke call backs that will trigger an equivalent amount of scrolling in the x dimension on the column-heading window, as well as an equivalent amount of y-dimension scrolling on the row-heading window.

Shouldn't be too hard, once you find the right Tk man page (probably Tk::Scrollbar). Good luck with that.

(update: fixed the link and a spelling error, and wanted to add that you probably want to limit the number of visible scrollbars for all those scrolling windows -- display just one scrollbar for each direction -- and bear in mind that Tk lets the user to a "grab-and-drag" to scroll the grid window.)