On Mon, Mar 23, 2009 at 5:35 PM, Ben Lachman <blach...@mac.com> wrote:
> How do you call through to some arbitrary class in a class's inheritance
> chain?

Typically, you don't.  Just hand it off to super.  NSView isn't
declared to implement -scrollWheel:.

If you *really* need to invoke a specific class's implementation of a
method, use class_getInstanceMethod to get the method's
implementation, and then just invoke that implementation:

// Warning: written in mail client, YMMV etc.
- (void)scrollWheel:(NSEvent *)theEvent
{
  Method theMethod = class_getMethod([NSResponder class],
@selector(scrollWheel:));
  IMP theImpl = method_getImplementation(theMethod);
  (void (*) (id, SEL, NSEvent*))(theImpl)(self,
@selector(scrollWheel:), theEvent);
}

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to