Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Missing Mouse Events in PDFView




Really? Outside of things like buttons, that's an unfortunate choice, isn't it? As the "Cocoa Event-Handling Guide" points out, a class that handles dragging in this manner is "more difficult to extend without the subclass reimplementing all the dragging code".

Absolutely. I don't use PDFView but I had to do some unpleasant things when sub-classing NSTextView (which behaves the same way). I was under the impression that this was a NextStep holdover and that new things wouldn't do it.



It turns out that, for tracking in any event, a lot of state has to be
kept (instance vars) in order to handle dragging or tracking across
the three event flavors.

So? So keep it. What is the problem? If you're worried about the allocated size of the object, put your state information in a struct and allocate it on mouseDown and free it on mouseUp. That way you only increase the size of the object by a few bytes. The other way really limits the usefulness of the object because you can't subclass it properly. (Not to mention confusing beginners who look at the docs, see a subclass of NSResponder and wonder why their methods never get called.)


Robert Clair


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.