🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #426

mousedragging and scrollview

#426
From: Nick Kline
Date: Mon, 03 Aug 1992 21:21
64 lines
2599 bytes
I've got a problem with autoscrolling my document when the user
drags a mouses, or just holds the button down.

My view is the delegate for a window, so it receives
the mouse down messages.  My view is inside a scrollview in the
window, larger than the frame of the window.

The way it should work, according to the example I copied from the
docs is (in pseudo code):

mousedown:
	/*start modal loop*/
	start timer
	while( in loop)
	    event = getNextEvent( MouseUP, MouseDragg, Timer)
	    switch(event->type)
		case Timer:
			[self autoscroll lastEvent->point];
			break;
		case MouseUp
			exit loop
			break;
		case MouseDragg:
			lastEvent = event;
			break;
endofmousedown

So theoretically, each time the user drags the mouse, I save that
point.  Then, while the user is just holding the mouse still outside
the frame of my window, timer events occur and the view inside the
window scrolls appropiately.  If the mouse button is held down without
moving the mouse inside the window, nothing should happen.

What actually happens is that if the mouse button is clicked and held down
while inside the window, and the user does not move it, then the
window scrolls down to the very bottom of the view.  

I have flipped the y axis, so 0 is the upper left of my view.  There
are several possible solutions.  The most obvious cause to this
problem would seem to be that the autoscroll point I am passing
needs to be transformed.  The documenation with this code snipped and
with the view class says that the event I get is in window coords,
and the autoscroll point should be in window coords.  So it *looks* like
I am doing the right thing.

When I drag the mouse and hold it above the view, it scrolls correctly, with
the view reasonably moving the way it should.  I can scroll it down to the
bottom by dragging past the bottom of the window.  All seems as it should
be, except for the problem when I hold the mouse still.  

The other possible solution is that I need to detect whether the mouse
is in the window or not, and if it is not, then call autoscroll.


It just seems like I should be able to call the autoscroll without doing
the hit detection.  If no one has any suggestions, then I will try that.


-nick
kline@cs.arizona.edu



			
Technical Details
Message-ID: <20000@optima.cs.arizona.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!ncar!noao!arizona!kline

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!ncar!noao!arizona!kline
From: kline@cs.arizona.edu (Nick Kline)
Newsgroups: comp.sys.next.programmer
Subject: mousedragging and scrollview
Message-ID: <20000@optima.cs.arizona.edu>
Date: 3 Aug 92 21:21:04 GMT
Sender: news@cs.arizona.edu
Lines: 66