• 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 not getting mouseDown
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField not getting mouseDown


  • Subject: Re: NSTextField not getting mouseDown
  • From: Graham Cox <email@hidden>
  • Date: Fri, 23 Oct 2009 01:17:04 +1100


On 23/10/2009, at 1:08 AM, Sander Stoks wrote:

Background: I am using NSPanel to make a "tool window" for my app. This window contains a few buttons, sliders, and an NSTextField. I wanted this window to avoid becoming key, so that the user can select a new tool on this window without her main window losing focus and her having to select it again. I managed to get the right behavior by overriding canBecomeKeyWindow and returning NO. All buttons and sliders were fully operable this way.

Until I added an NSTextField, which obviously needs its containing window to be the key window to work. I couldn't get this combination of requirements implemented successfully, so I solved it partially by making my own textfield and panel subclasses; when the textfield gets a mouseDown, I send a "focusRequested" message to its panel, which then sets a boolean ivar, like so:


What you want is to remove all this stuff and look at [NSPanel setBecomesKeyOnlyIfNeeded:] which deals with whatever is necessary for you. Standard text fields and so on should then work properly.

--Graham


_______________________________________________

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 not getting mouseDown
      • From: Sander Stoks <email@hidden>
References: 
 >NSTextField not getting mouseDown (From: Sander Stoks <email@hidden>)

  • Prev by Date: stringWithContentsOfURL with resulting error 256
  • Next by Date: Re: Displaying a view modally
  • Previous by thread: NSTextField not getting mouseDown
  • Next by thread: Re: NSTextField not getting mouseDown
  • Index(es):
    • Date
    • Thread