[comp.windows.x.motif] Scrolled Window: Area Size

davej@sp31.csrd.uiuc.edu (David J. Jablonowski) (02/20/91)

   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. This means I need the width and height
of this viewing area as well as the coordinates of the Drawing Area that
appear.

   This is not for refreshing; I am well aware of the Expose Callbackbacks
and the accumulation of Regions.

   Ii seems that I can get close by going thru a bunch of yoga involving
getting the scrollbars, thier dimensions, their values, the size of the
scrolled window itself ..., and doing some calculations. But it seems
I still seems that I am missing some 'margins' or something. Is there
a nice way to determine this info ?

bobm@hpcvlx.cv.hp.com (Bob May) (02/21/91)

>   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. This means I need the width and height
> of this viewing area as well as the coordinates of the Drawing Area that
> appear.
> Is there a nice way to determine this info ?

   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.
   
   Bob May
   Hewlett-Packard
   Interface Technology Operation
   bobm@hpcvlx.cv.hp.com