• 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: Getting double-clicks on NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting double-clicks on NSTextField


  • Subject: Re: Getting double-clicks on NSTextField
  • From: Steve Nicholson <email@hidden>
  • Date: Sun, 22 Jun 2008 00:32:46 -0700

On Jun 18, 2008, at 8:25 PM, Steve Nicholson wrote:
I have an NSTextField on my window that is neither editable nor selectable. Is there a way for my window controller to be notified when the user double-clicks on the field?


On Jun 18, 2008, at 6:04 PM, Andy Lee wrote:
I don't know if there's a better way, but this works:

NSTextField doesn't have a doubleAction, but NSMatrix does. So instead of an NSTextField, use an NSMatrix with just one cell. You can do this in IB by selecting the NSTextField and selecting Layout >> Embed Objects In >> Matrix from the menu. In your window controller's awakeFromNib, do this:

[_textFieldMatrix setTarget:self];
[_textFieldMatrix setDoubleAction:@selector (doTextFieldDoubleClick:)];


--Andy

Thanks. That worked a treat.

-Steve
_______________________________________________

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


References: 
 >Getting double-clicks on NSTextField (From: Steve Nicholson <email@hidden>)
 >Re: Getting double-clicks on NSTextField (From: Andy Lee <email@hidden>)

  • Prev by Date: [Q] IMKit: IMKInputController and its menu handler
  • Next by Date: Re: zlib in 10.4 and 10.5
  • Previous by thread: Re: Getting double-clicks on NSTextField
  • Next by thread: Services menu invoke from the command line?
  • Index(es):
    • Date
    • Thread