Re: NSToolbar(item) quirk
Re: NSToolbar(item) quirk
- Subject: Re: NSToolbar(item) quirk
- From: Evan Schoenberg <email@hidden>
- Date: Thu, 3 Feb 2005 18:28:02 -0600
Preface: There's probably a better solution than this, but this should
work.
The validate method passes you which toolbarItem you're validating for.
Enumerate through your documents list... for each one, check if its
window's toolbar contains the item you're passed. When you find the
right one, you have the window (and document) corresponding to that
toolbar item and so can perform appropriate validation.
-Evan
On Feb 3, 2005, at 10:33 AM, Ed wrote:
Hi all!
I've got a Cocoa Multi-Document application (standard project kind),
and each of my MyDocuments has a toolbar on its associated window. To
ensure my toolbar button only becomes active when there is text
selected in an NSTextView in the window, I'm using simple validation
(If the selection length is 0, then it's not active, essentially).
However, when I have multiple documents open, if I select text in one,
all of the ToolbarItems of that type in the application become
activated! Not only that, but I can actually click on them (though if
I click on the window, they stop becoming deactivated, as they should
be)!
Has anyone come across this before and have an elegant solution, or I
am I just going to have to give each button its own string identifier
(using a random number gen, perhaps?)
Thanks,
ed
_______________________________________________
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
_______________________________________________
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