Skip navigation.
 
mlRe: Call method from a different file
FROM : Andrew Merenbach
DATE : Thu Aug 31 07:03:33 2006

Hi, Brian.  If you want your table view (let's call it myTableView) 
to call a method in a different class (call it myOtherClass), I'd 
suggest hooking up myTableView's 'delegate' variable to 
myOtherClass.  This can be done in Interface Builder, or can be done 
programmatically via [myTableView setDelegate:myOtherClass].

Then, from your -keyDown: (assume that myOtherClass has a class type 
of BAOtherClass): {
   [(BAOtherClass *)[self delegate] performMyMethod];
}

Make sure to #import "BAOtherClass.h" into your table view subclass.

Cheers,
   Andrew

On Aug 30, 2006, at 1:33 PM, Brian Amerige wrote:

> Hi all,
>
>     I've got a subclassed NSTableView, and I'm overriding the keyDown 
> method. However, the method I want to call (when, for example, the 
> enter key is pressed) is in a different file. (My AppController.m 
> file). How would I call it from my subclass?
>
> Thanks.
> Brian Amerige
> http://extendmac.com
> http://cocoaforum.com
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/andrew.merenbach%
> 40ucla.edu
>
> This email sent to andrew.<email_removed>

Related mailsAuthorDate
mlCall method from a different file Brian Amerige Aug 30, 22:33
mlRe: Call method from a different file I. Savant Aug 30, 22:52
mlRe: Call method from a different file Andrew Merenbach Aug 31, 07:03