🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #23843

Re: Setting the viewable region of the Athena viewport

#23843
From: George Ross
Date: Tue, 18 Jun 1991 09:13
34 lines
2472 bytes
In article <1991Jun17.084423.11830@melba.bby.oz.au>, gnb@bby.oz.au (Gregory N. Bond) writes:
> One of our users is writing an application that has a List widget
> inside a viewport widget.  He wants to be able to scroll a particular
> line of the list to the (top,center,bottom) of the viewport, but I
> can't see any calls &/| resources to do this. 

Funny how just as you're about to post something somebody else gets in first
to say the same thing.  Anyway, the following hack is what I'm currently
using (I have a Label inside the Viewport).  There must be a better way!

                /* This is revolting, but there doesn't seem to be any
                 * other way to get the thing to scroll right to the bottom */
                scrollbar = XtNameToWidget(viewport, "vertical");
                if (scrollbar) {
                        n = 0;
                        XtSetArg(args[n], XtNwidth, &scrollWidth);      n++;
                        XtSetArg(args[n], XtNheight, &scrollHeight);    n++;
                        XtGetValues(scrollbar, args, n);
                        /* Fake up a button event -- enough to pacify the
                         * Scrollbar widget, at any rate... */
                        be.type = ButtonPress;
                        be.x = scrollWidth / 2;
                        be.y = scrollHeight - 1;
                        XtCallActionProc(scrollbar, "StartScroll", &be, &cont, 1);
                        XtCallActionProc(scrollbar, "MoveThumb", &be, NULL, 0);
                        XtCallActionProc(scrollbar, "NotifyThumb", &be, NULL, 0);
                        XtCallActionProc(scrollbar, "EndScroll", &be, NULL, 0);
                }
                /* YUK! */

-- 
George D M Ross, Department of Computer Science, University of Edinburgh
     Kings Buildings, Mayfield Road, Edinburgh, Scotland, EH9 3JZ
Tel: 031-650 5147   Internet: gdmr@cs.ed.ac.uk   JANET: gdmr@uk.ac.ed.cs
Technical Details
Message-ID: <12743@skye.cs.ed.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!mcsun!ukc!edcastle!cs.ed.ac.uk!gdmr
References: <1991Jun17.084423.11830@melba.bby.oz.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!mcsun!ukc!edcastle!cs.ed.ac.uk!gdmr
From: gdmr@cs.ed.ac.uk (George Ross)
Newsgroups: comp.windows.x
Subject: Re: Setting the viewable region of the Athena viewport
Message-ID: <12743@skye.cs.ed.ac.uk>
Date: 18 Jun 91 09:13:16 GMT
References: <1991Jun17.084423.11830@melba.bby.oz.au>
Sender: nnews@cs.ed.ac.uk
Organization: Department of Computer Science, Edinburgh University
Lines: 34