|
|
Menu item action to controller object
|
|
|
|
Fresh-Faced Recruit
Join Date: Sep 2006
Status:
Offline
|
|
I am using Cocoa.
I'm trying to make one of my menu items perform an instance method (I think those are the right words) of my controller object. When I connect from the menu item to the controller object, there are only a few options availble for connection, such as fax, performClick, print, takeDoubleValueFrom, etc.
So to get around that I have a hidden button on my window, which the menu item performClicks on, and that button is in turn connected to the controller object.
Is there a better way to do this?
|
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Add more methods to your controller object in Interface Builder?
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Sep 2000
Location: Norfolk, Va
Status:
Offline
|
|
You should read this: Currency Converter tutorial Seriously, it'll take a few hours but it will save you days of heartache. It, and pretty much every tutorial I've ever seen, is well worth the investment of understanding them. By the way, the best Ladder of tutorials ever for Cocoa, even though they're like 5 years old, is Oreilly's MacDevCenter. Start at the bottom, more or less. More up to date and really helpful gab is at CocoaDevCentral
But basically, you need to implement a method in your class called (and it must appear in the header file too):
-(IBAction)doSomething: (id)sender;
then, in IB, go to the menu "Classes - > Read myClass.h". Now dragging a connection from your menu item to that object instance should show you the option of connecting it to that method.
|
you are not your signature
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Sep 2006
Status:
Offline
|
|
Thank you both very much for helping out a newb!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|