• 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
Re: NSTextfield focus in contextual menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextfield focus in contextual menu


  • Subject: Re: NSTextfield focus in contextual menu
  • From: Kyle Sluder <email@hidden>
  • Date: Thu, 17 Jan 2013 11:54:04 -0800

On Thu, Jan 17, 2013, at 11:38 AM, Tamas Nagy wrote:
> Hi List,
>
> I have an application (10.6>) where are have a contextual menu with an
> NSTextfield. What I'm trying is when I displaying the menu with [NSMenu
> popupContextual…] making the NSTextfield focused, but without luck.
>
> I tried setting [mytextfield becomeFirstResponder] and [mytestfield
> selectText:nil] before the popup method called, but it not works - I'm
> not sure this is technology even possible.

Sadly, views-in-menus is a generally broken technology. It's good for
drawing custom content, but that's about it.

If you want to do this, you'll probably want to build a custom
NSMenu-lookalike. This is how Spotlight is implemented, for example.

Alternatively, you may be able to subclass -[NSApplication sendEvent:]
and feed the right data to the text field on your menu. I've heard
rumblings that this is how Xcode implements its typeahead searching in
menus.

--Kyle Sluder

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: NSTextfield focus in contextual menu
      • From: Tamas Nagy <email@hidden>
    • Re: NSTextfield focus in contextual menu
      • From: Tamas Nagy <email@hidden>
References: 
 >NSTextfield focus in contextual menu (From: Tamas Nagy <email@hidden>)

  • Prev by Date: Re: Changing color in NSColorPanel without message
  • Next by Date: Re: NSTextfield focus in contextual menu
  • Previous by thread: NSTextfield focus in contextual menu
  • Next by thread: Re: NSTextfield focus in contextual menu
  • Index(es):
    • Date
    • Thread