toggleToolbarShown - how to validate menu item?
toggleToolbarShown - how to validate menu item?
- Subject: toggleToolbarShown - how to validate menu item?
- From: Manfred Lippert <email@hidden>
- Date: Wed, 13 Feb 2002 11:11:45 +0100
Hi,
I have a window with a toolbar. In the menu bar there is the item "Toggle
Toolbar" which originally was connected to the action "toggleToolbarShown"
of the FirstResponder.
It worked, but if my window has a sheet attached, the menu item is enabled,
but has no function! (Is that a bug in Cocoa??) I tried to workaround in the
following way:
I changed the connection to a newly created action named "toogleToolbar",
because "toogleToolbarShown" is in NSWindow and I have no subclass of
NSWindow to override it and I also wanted to override "validateMenuItem". I
have only a subclass of NSDocument.
I implemented "toggleToolbar" in my NSDocument subclass in the way that it
simply calls "toggleToolbarShown" on its window. That works.
Now I was able to implement "validateMenuItem" on my NSDocument subclass and
it gets called when the Toggle Toolbar item (and others) is validated to be
enabled/disabled. That works also, BUT:
Originally Cocoa changed the "Toggle Toolbar" menu item text into "Show
Toolbar" and "Hide Toolbar" (and in the approprioate language my app is
running) depending on the visiable state of the toolbar. Now it stays on
"Toggle Toolbar" and is never changed.
My question: Where and when is Cocoa changing this name and how can I force
it to do this? I tried to call "validateMenuItem" on different places prior
to the return of my own result in my "validateMenuItem" callback but none
worked. I tried to call it on the window (NSWindow) on the original
NSDocument (super) and on NSApp. None worked, the item text stays "Toggle
Toolbar".
How can I validate (correct) the Toggle Toolbar item state myself _and_ let
Cocoa rename the item to the correct title?
Regards,
Mani
_______________________________________________
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.