• 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: Contextual Menu in NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Contextual Menu in NSTextField


  • Subject: Re: Contextual Menu in NSTextField
  • From: stephane sudre <email@hidden>
  • Date: Fri, 18 Mar 2005 14:30:12 +0100


On Mar 18, 2005, at 2:28 PM, Peter Lennie wrote:

My application's window drops a sheet that contains an NSComboBox and an NSTextField (actually several of each). For these views I want to replace the default contextual menus with my own. I have tried several ways to do this, but I cannot get the views reliably to use my menu rather than their default class menus.

1). In the nib file I've connected each view to the menu I want to use. On right-click or control-click my menu is displayed only when the NSComboBox or NSTextField is *disabled* or is not firstResponder. When a view of either class is firstResponder its default class menu appears.

2. I've tried subclassing both NSComboBox and NSTextField and using menuForEvent to return the menu I want, but menuForEvent is called on right-click or control-click only if the view is disabled or is not firstResponder.

I'd be grateful for advice on how to get my contextual menu to be displayed reliably.

AFAIK, the contextual menu you're seeing and would like not to see is the one from the Window's Field Editor.


So would you like not to see it, you could:

o subclass NSText and implement your own menuForEvent:

o implement - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject in the delegate of your sheet to return a shared instance of your NSText subclass.

My $0.02

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


References: 
 >Contextual Menu in NSTextField (From: Peter Lennie <email@hidden>)

  • Prev by Date: Contextual Menu in NSTextField
  • Next by Date: Re: Need serious help with NSOutlineView
  • Previous by thread: Contextual Menu in NSTextField
  • Next by thread: RE: [NSKeyValueArray removeObjectAtIndex:]: selector not
  • Index(es):
    • Date
    • Thread