🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
1 messages
1 total messages Started by - Mon, 11 Jan 1993 05:55
window dragging
#2281
Author: -
Date: Mon, 11 Jan 1993 05:55
52 lines
2213 bytes
i'm having a problem getting a window to drag properly when the user drags in
a view within the window (the window is a NX_PLAINSTYLE window so it has no
titlebar).  it seems to work fine except that every now and then, the window
"vibrates" around the mouse point.  for example, if i start dragging the
window to the left, the window, every now and then, will oscillate in a 
circular  fashion for a  half a second.  the amplitude of the oscillations
sometimes reaches a hundred pixels or so.
here's the code (it should be pretty straightforward):
- mouseDown:(NXEvent *)theEvent
{
    NXPoint	current;
    NXCoord	dx, dy;
    NXRect	wframe;
    BOOL	tracking = YES;
    int		mask;

    mask = [window addToEventMask:NX_MOUSEDRAGGEDMASK];

    current = theEvent->location;
    [window getFrame:&wframe];
    [window convertBaseToScreen:&last];
    dx = NX_X(&wframe) - current.x;
    dy = NX_Y(&wframe) - current.y;
    theEvent = [NXApp getNextEvent:MOVE_MASK];
    if (theEvent->type == NX_MOUSEUP) {
	return self;
    }

    while (tracking) {
	current = theEvent->location;
	[window convertBaseToScreen:&current];
	[window moveTo:(current.x + dx) :(current.y + dy)];
	tracking = (theEvent->type != NX_MOUSEUP);
	if (tracking) {
		NXPing();
		theEvent = [NXApp getNextEvent:MOVE_MASK];
	}
    }
    [window setEventMask:mask];

    return self;
}

i can't use dragFrom::theEvent: because i need to move other windows with this
one (dragFrom::theEvent: doesn't send window update messages to the delegate).
so, if anyone can either find the error in my code or tell me of another way
to get several windows to move in tandem with the one the user is dragging,
let me know.

thanks in advance,
paul kim
pkim@cory.berkeley.edu
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads