return YES from validateMenuItem but menu item remains disabled
return YES from validateMenuItem but menu item remains disabled
- Subject: return YES from validateMenuItem but menu item remains disabled
- From: Mark Sanvitale <email@hidden>
- Date: Tue, 30 Jan 2007 17:09:23 -0800
Subject line states the problem. My object is the target of the menu
item. It also implements the validateMenuItem method. This method
is being called at the correct time (e.g. before the menu containing
the item is displayed). My object's validateMenuItem method returns
YES for the menu item hooked to its target method. Menu item appears
disabled.
The non-standard component in this situation is that the frontmost
(i.e. looks active) window on the system when the menu in the menu
bar is being clicked-on does not belong to the application in
possession of the menu bar. Rather, the window belongs to an
LSUIElement application, i.e. one which has no menu bar, is normally
invisible, but can display a window/dialog.
I want to be able to control the enabled/disabled state when in this
non-standard situation, and, as I wrote, my validateMenuItem method
is being called so it appeared that my needs would be met. But, they
are not.
Does anyone know if the system is setup to force all menu items in
the menus of the menu bar to be disabled (despite continuing to ask
the application code for its opinion on the matter) given the
described situation?
I tried turning off the "Auto Enable Items" feature for the menu
which contains the menu item in question. As expected, my
validateMenuItem method no longer gets called, all the items in the
menu appear enabled when not in the described, non-standard state,
but when the no-associated-menu-bar window is frontmost then all the
items appear disabled. Even tried turning off "Auto Enable Items"
for the whole "main menu" (i.e. menu bar). No change in behavior.
So, I guess control over auto enabling/disabling of items is not as
rich as I would have hoped because, obviously, at some level,
something is still doing so automatically and I don't like the results.
Thanks.
Mark Sanvitale
Exbiblio
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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