• 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
Unable to create outlets/connections for NSMenuItems, but other controls work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unable to create outlets/connections for NSMenuItems, but other controls work


  • Subject: Unable to create outlets/connections for NSMenuItems, but other controls work
  • From: Alex Hall <email@hidden>
  • Date: Tue, 01 Sep 2015 14:21:06 -0400

Hello list,
The subject says it. The procedure for making connections to IBOutlets or IBActions seems to work perfectly when I use it to hook up NSButton, NSTextField, or NSTable controls. When I do the exact same thing for NSMenuItems, though, nothing happens. I'm using VoiceOver, and so I get no visual feedback as far as lines stopping or things turning colors, and no popovers or alerts are appearing with information about the problem. In case it helps, I'll outline the procedure I'm using--again, this works unless I'm using it on a menu item.

1. Write the line of code (outlet or action) in the view controller file, then build.
2. In the ruler next to the source code, find the button corresponding to the newly created outlet/action. VO identifies this as a button, though I don't think it actually is one. The text of this supposed button is something like "IBOutlet - [outlet_name], in [file_name], not connected".
3. Put the mouse on the button (vo-cmd-f5), lock the mouse down (vo-shift-cmd-space), and move over to the storyboard (I'm assuming you have both open at once, using an assistant editor).
4. In the storyboard outline table, find the control you want to hook to the outlet/action (be sure to interact with the table). To the right of the control is an unlabeled button; once VO is on it, route the mouse there and release it (vo-shift-cmd-space again). Note that, at least from what I've been told, this button next to everything in a storyboard outline is invisible visually, only appearing to VoiceOver.

That's it. Not as easy as control-dragging, but it's the only consistent way I know of. I just tried it, right before writing this email. In the very same project, it hooked a newly added button to an outlet on the first try, and did absolutely nothing for an NSMenuItem after three attempts. Are menu items simply not treated the same as most other controls / is there a different way I should be doing this? I just want to hook menu items to actions so I can actually have them do things. I've found the delegate protocol, at
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSMenuDelegate_Protocol/index.html#//apple_ref/occ/intfm/NSMenuDelegate/menuHasKeyEquivalent:forEvent:target:action:

but that seems like overkill for basically the same procedure I'd use on a button. If this is the wrong list for this question, let me know; it seemed to fit equally well here and on the cocoa-dev list. Hopefully it's not off-topic. Anyway, thanks in advance for any answers.

--
Have a great day,
Alex Hall
email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Unable to create outlets/connections for NSMenuItems, but other controls work
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: "Use of unresolved identifier" when using a framework which Xcode can see
  • Next by Date: Re: Unable to create outlets/connections for NSMenuItems, but other controls work
  • Previous by thread: Re: "Use of unresolved identifier" when using a framework which Xcode can see
  • Next by thread: Re: Unable to create outlets/connections for NSMenuItems, but other controls work
  • Index(es):
    • Date
    • Thread