tbray@watsol.waterloo.edu (Tim Bray) (02/23/91)
bobm@hpcvlx.cv.hp.com (Bob May) writes: |someone writes: || I have a Scrolled WIndow with a scrollingPolicy of AUTOMATIC and a || scrollBarDisplayPolicy of AS_NEEDED. The work area of this Widget is a || Drawing Area. What I need to do is to determine, at arbitrary times, the || exact rectangular regtion of the Drawing Area that is visible thru the || viewing area of the Scrolled Window. | Try getting the widget ID contained in the Scrolled Window's XmNclipWindow | resource, then do a GetValues on the width and height of that widget. | Should be just what you need. Odd that this should come up. I just spent the best part of a day trying to figure out why this doesn't work. If I do the following: XtSetArg(arg[0], XmNclipWindow, &clip); XtGetValues(scrolledwindow, arg, 1); XtSetArg(arg[0], XmNwidth, &width); XtSetArg(arg[1], XmNheight, &height); XtGetValues(clip, arg, 2); Then I am regularly but somewhat unpredictably getting garbage values back in width & height. I'm about 90% ready to call this a bug, since (1) the rest of this (large) application is working fine, and (2) these failures occur, but in different places, in the same app on a dec3100 and Sparc (more on the Sparc - it basically never works) - both the same MIT X11R4 & Motif 1.1 (3) if I break down and call XGetGeometry on XtWindow(clip), I get the right answers. So there *may well* be a real bug here. On a related note, I tried to resize the clip window, via a somewhat equivalent XtSetArg/XtSetValues sequence, and it flatly ignored me, but this may be a function of the Form it's living in; or maybe you just can't resize the clipWindow of a ScrolledWindow. Motif is just great, except when it isn't. Cheers, Tim Bray