[comp.graphics] SunView Programming: Canvas question

jaysun@saurez.eng.clemson.edu (Jay Williamson) (09/09/89)

This is hard to explain but I can not work out a fix in multiple
hours of trying so its worth a try.

I am using the SunView graphics library to write a program that
will be dragging objects such as springs, dampers and masses across
a SCROLLABLE canvas. Before the scrollable canvas I had no problem
obtaining the x-y cooridinates of the canvas.

In my canvas event proc:

    canv_event = canvas_event(canvas, event);
    xnew=event_x(canv_event)+scr_offset;
    ynew=event_y(canv_event)+scr_offset;

where scr_offset is the offset caused by the scrollbars (already determined)

The problem arises when I click the mouse button the object appears
and is ready to be dragged across the canvas, but it is offset by the
amount of canvas hidden behind the scrollbar.  (ie. If the canvas is
scrolled to the bottom right corner the object will appear initially
far to the right and below the cursor.) (ie^2. In the initial position 
of the canvas the object will appear 14 pixels to the left and 14 
pixels above the cursor) 

As soon as the cursor moves the object jumps to the right place.

I have tried enabling all the LOC_xxx options for the canvas but
none have changed it.

What is really weird is that the numbers are correct.

Does anybody know of weird quirks concerning my problem?

Please help ... I'm going Crrraaaazzzyyyyyyyy.....

Jay Williamson            Engineering Computer Operations
jaysun@eng.clemson.edu    Clemson University
|---------------------------------------------------------|
|  "A conclusion is the place were you got tired          |
|        of thinking."                                    | 
|                                 --Arthur Block          |
|---------------------------------------------------------|

Jay Williamson    <jaysun@eng.clemson.edu>