thelen@SRC.Honeywell.COM (Karen Thelen) (08/23/90)
I am using the Athena widget set on sun 3 and 4s. I have a list widget whose parent is a viewport widget so that I am able to scroll the list. As my application adds elements to the list, I want the list scrolled forward. The most recently added are at the bottom of the list and are therefore of more interest to the user. I want the application to make the bottom most list items visible rather than the portion of the list that the user last scrollbar to. How do I get the list to scroll from my application instead of by user action? Any tips would be appreciated. Thanks, Karen Thelen thelen@src.honeywell.com
pk@stc.lockheed.COM (PK) (08/24/90)
Here is a diff file that has a function that I defined which has
worked for me.
XawViewportMoveChild(widget,xoffset,yoffset)
The offsets are specified as floats ranging from 0 to 1 which
determines the offset from the top left corner. A value of
-1 will leave the particular axis unchanged.
PK
pk@nmsu.edu
pk@stc.lockheed.com
*** Viewport.c Tue Jul 3 14:44:42 1990
--- /src/R4/mit/lib/Xaw/Viewport.c Fri Dec 15 10:37:55 1989
***************
*** 409,437 ****
RedrawThumbs(w);
}
- void XawViewportMoveChild(w,xoff,yoff)
- ViewportWidget w;
- float xoff,yoff;
- {
- register Widget child = w->viewport.child;
- Position x,y;
-
- if(xoff > 1.0) /* If the offset is > 1.0 scroll to */
- x = child->core.width; /* extreme right */
- else if (xoff < 0.0) /* if the offset is < 0.0 no movement */
- x = child->core.x; /* in the x direction */
- else
- x = child->core.width * xoff;
- if(yoff > 1.0)
- y = child->core.height;
- else if (yoff < 0.0)
- y = child->core.y;
- else
- y = child->core.height * yoff;
-
- MoveChild(w,-x,-y);
- }
-
static void ComputeLayout(widget, query, destroy_scrollbars)
Widget widget; /* Viewport */
--- 409,414 ----