Path: utzoo!attcan!uunet!ginosko!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!odi.COM!bob From: bob@odi.COM (Bob Miner) Newsgroups: comp.windows.x Subject: Re: Scrolling a spreadsheet inside a Viewport Message-ID: <8908221328.AA08747@mojo.odi.com> Date: 22 Aug 89 13:28:29 GMT References: <15316@umn-cs.CS.UMN.EDU> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 60 > I am developing a small spreadsheet sort of application using > Xaw. I am using X11R3. > > [...stuff deleted...] > > I want Column titles on the top row and Row titles in the > leftmost column of my spreadsheet. The Column titles scroll ONLY > horizontally and similarly the Row titles scroll ONLY vertically. > That is the problem. I am quite sure if (and how) I can > achieve such 'partial' scrolling. > > [...stuff deleted...] I'd recommend you do one of two things, depending on how you want your spreadsheet to look. If you want the scrollbars to extend the full width and height of the window, including to the right of the column titles and below the row titles, #1 is the way to go. If you want the scrollbars to only extend to the boundaries of the cell area, leaving the space to the right of the column titles and below the row titles empty, #2 is the way to go. 1. Create a form widget with 6 child widgets - 2 scrollbar widgets (one horizontal and and another vertical) and 4 core widgets (one for the column titles, another for the row titles, a third for the cells and a fourth for that little square area where the row titles and cell titles intersect). You'll need to do scrolling in the core widgets yourself when you receive callbacks from the scrollbars. 2. Create a form widget with 4 children - 3 core widgets (one for the column titles, another for the row titles and the third for that little square area again) and 1 viewport widget with scrollbars. Again, though, when the person scrolls the cell area in the viewport widget, you'll have to have set up a callback such that you know to scroll either the column or row area. The answer you're really looking for is a way to synchronize the scrolling of one widget's contents with the scrolling of another widget's contents. I know of no way to do that with the Athena widgets (or any other toolkit). Another possibility, one which I've implemented but which takes more effort, is to forget about making the column, row and cell areas separate widgets and draw them all in one core widget. You'll then need to do clipping to each area yourself. There are advantages to this approach in that you'll be able to draw to all three areas simultaneously (with one Xlib call) which looks smoother during scrolling and dynamic cell selection than first drawing in the cell area with one Xlib call and then drawing in either the row or column area with another Xlib call. I haven't used the Athena widget set much myself, so I could be off slightly on the exact capabilities of the Athena widgets. Most form and scrollbar widgets in the various toolkits provide similar capabilities, however. Good luck, Bob Miner Object Design, Inc. 1 New England Executive Park Burlington, MA 01803 (617) 270-9797 Email: bob@odi.com