• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Need HELP - Dragging a view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need HELP - Dragging a view


  • Subject: Re: Need HELP - Dragging a view
  • From: Scott Anguish <email@hidden>
  • Date: Thu, 2 Mar 2006 03:05:56 -0500

it's best not to rely on views as your application's child objects like this. In fact the Cocoa performance docs recommend against it explicitly.

this is probably terribly slow because you're dragging the same view that is getting the events..


On Mar 2, 2006, at 2:34 AM, "" <email@hidden> <email@hidden> wrote:



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

_______________________________________________ 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
References: 
 >Need HELP - Dragging a view (From: "" <email@hidden>)

  • Prev by Date: Re: How to get the values entered in pagesettings panel in a Document based Application
  • Next by Date: Need HELP - Dragging a view
  • Previous by thread: Need HELP - Dragging a view
  • Next by thread: Need HELP - Dragging a view
  • Index(es):
    • Date
    • Thread