mhardik@intel.com (Manoj Hardikar ~) (07/28/89)
I would like to scroll the child in the viewport widget (Athena widget set R3) under program control (to top, bottom or some percentage). I have thought of sending appropriate button events to the scrollbars in the viewport widget, but is there an easier/cleaner way of doing that? Any help would be appreciated. Thanks. ------------------------------------------------------------------------------ Manoj A. Hardikar Intel Corporation MS SC3-17 2625 Walsh Ave, Santa Clara, CA 95052 ARPA: mhardik@cadev4.intel.com -- --------------------------------------------------------------------------- Manoj A. Hardikar (mhardik@cadev4.intel.com) SC3-17 X5-4636 ---------------------------------------------------------------------------
kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (07/28/89)
> I would like to scroll the child in the viewport widget (Athena widget set > R3) under program control... This behavior is not supported in R3. I may get around to it for R4, but I have lots of other things on my plate. Of course, if someone were to send me context diffs of an implementation... Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213
pannaiya@NMSU.EDU (07/28/89)
Here are the context diffs that defines a function implementing the
software scrolling capability in the R3 Athena Viewport widget.
The name I used was XtViewportMoveChild(W, xoff, yoff). I guess it really
ought to be XawView... Anyway the functionality is as follows:
xoff and yoff are floating point numbers in the range 0.0 and 1.0. The
child's new position has to be expressed as the position from the top/left.
If the ?off is > 1.0 the child will be moved to the extreme right/bottom.
if the ?off is < 0.0 the position on the axis remains unchanged.
This has worked for me(so far). If the Xaw gods see any flaw in it please
post.
PK
-----------------------------8<----------------->8---------------------
*** vtemp.c Thu Jul 27 17:54:51 1989
--- Viewport.c Thu Jul 27 17:57:59 1989
***************
*** 383,388 ****
--- 383,411 ----
RedrawThumbs(w);
}
+ void XtViewportMoveChild(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 Resize(widget)
Widget widget;
{