Re: Problem with validateMenuItem and a Modal Dialog, maybe a bug in Cocoa...
Re: Problem with validateMenuItem and a Modal Dialog, maybe a bug in Cocoa...
- Subject: Re: Problem with validateMenuItem and a Modal Dialog, maybe a bug in Cocoa...
- From: "Clark S. Cox III" <email@hidden>
- Date: Wed, 22 Jan 2003 09:24:02 -0500
On Wednesday, Jan 22, 2003, at 08:58 US/Eastern, Stiphane Sudre wrote:
According to the Cocoa documentation:
validateMenuItem:
- (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem
Implemented to override the default action of enabling or disabling
menuItem. The object implementing this method must be the target of
menuItem. It returns YES to enable menuItem, NO to disable it. You can
determine which menu item menuItem is by querying it for its title,
tag, or action.
----------------------------
This is working fine in the main window of my application.
o Now I have a NSTextField subclass instance in a NSPanel run as a
Modal dialog.
o There is a NSMenu attached to this NSTextField subclass instance.
(to the menu outlet)
o In this NSMenu, there's a NSMenuItem whose target is my NSPanel
controller.
o The NSPanel control implements the - (BOOL)validateMenuItem:(id
<NSMenuItem>)menuItem method.
When the NSMenu attached to the NSTextField subclass is displayed (via
a simple click), all its items are disabled and the validateMenuItem:
method is not called.
When I click on a NSPopUpButton item in this same NSPanel, the
validateMenuItem: method is called.
I checked at awakeFromNib and indeed the target and action of the
NSMenuItems of the NSMenu attached to the NSTextField subclass
instance are correct.
Is there some kind of magic to have validateMenuItem: be called for my
NSTextField subclass instance or do I just need to fill a bug report?
Make sure the NSMenu in question is set up to autoenable items (i.e.
either in IB, or by calling [menu setAutoenablesItems: YES].
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.