Need HELP - Dragging a view
Need HELP - Dragging a view
- Subject: Need HELP - Dragging a view
- From: "" <email@hidden>
- Date: Thu, 2 Mar 2006 02:34:17 -0500 (EST)
Hello!
I did a little app with a view that holds a subview.
My problem is to drag that subview around in its superview,
but it is SLOW!
I tried also to draw both the subview and the superview contents
using Quartz (in the -drawRect: methods), but with no success.
Any suggestion?
Thanks for any answer.
David.
My code in the subview implementation file
- (void)mouseDown:(NSEvent *)theEvent
{
NSPoint event_location = [theEvent locationInWindow];
NSPoint local_point = [self convertPoint:event_location fromView:nil];
dx = local_point.x;
dy = local_point.y;
}
- (void)mouseDragged:(NSEvent *)theEvent
{
MainView *mainView;
mainView = (MainView *)[self superview];
NSPoint event_location = [theEvent locationInWindow];
NSPoint local_point = [[self superview] convertPoint:event_location fromView:nil];
NSPoint origin;
origin.x = local_point.x - dx;
origin.y = local_point.y - dy;
[self setFrameOrigin:origin];
[self autoscroll:theEvent];
[mainView setNeedsDisplay:YES];
}
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden