Contextual Menu in NSTextField
Contextual Menu in NSTextField
- Subject: Contextual Menu in NSTextField
- From: Peter Lennie <email@hidden>
- Date: Fri, 18 Mar 2005 08:28:01 -0500
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.
Peter Lennie
--
Peter Lennie
Center for Neural Science
New York University
2-4 Washington Place
New York, NY 10003
_______________________________________________
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