• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Setting the action for a menu item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting the action for a menu item


  • Subject: Setting the action for a menu item
  • From: Jeffrey Mattox <email@hidden>
  • Date: Mon, 3 Feb 2003 17:19:50 -0600

I am using AppleScript Studio to write my application. Using Cocoa, however, I create a status bar menu and add several items to it. I have a loop for making the items that contains this code ("i" is the loop counter):

theMenuItem = [theMenu insertItemWithTitle:@"Item"
action:0 keyEquivalent:@"" atIndex:i];

1. It works fine (the menu and the items are there), but I don't know how to connect the "action:" to another routine in my Cocoa file. How do I do that?

2. The menu items will use the same handler, I just need to pass a different value for each item. I assume I use the "setTarget:" and/or "setTag:" methods -- is that correct? If so, does the tag show up as a parameter on the action handler?


Jeff
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Setting the action for a menu item
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Hidden Objects
  • Next by Date: Re: NSButtonCell not changing selection in table...
  • Previous by thread: Re: Hidden Objects
  • Next by thread: Re: Setting the action for a menu item
  • Index(es):
    • Date
    • Thread