Skip navigation.
 
mlRe: Call method from a different file
FROM : I. Savant
DATE : Wed Aug 30 22:52:32 2006

Brian, I recommend getting a good book on Objective-C as this is 
fairly basic stuff you should get a good handle on before pressing 
on. Specifically, don't think of things in terms of "files". Think in 
terms of "classes" and "instances of a class". Your .m file contains 
the description of the implementation of your class and the little 
blue box in your nib that represents your AppController class is an 
instance of that class.

  You *could* create an outlet on your NSTableView subclass called 
"controller" or "keyHandler" or "bob" if you like. Update your nib 
per the easily-found instructions (I usually drag the header file 
into the nib to update it). The outlet should now appear and you 
should now be able to ctl-drag a connection from your custom table 
view to the app controller instance in the nib. Now you have a 
channel through which to contact the app controller:

[bob tableKeyDown:myKeyDownEvent];

  Since "bob" points to your app controller, you can add the method 
"tableKeyDown:" or whatever you like to the AppController class and 
handle the key event any way you wish.

  Of course this may not be the best way of doing things for your 
particular situation, but it's "a" way.

--
I.S.


On Aug 30, 2006, at 4: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/idiotsavant2005%
> 40gmail.com
>
> This email sent to <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