Thank you, that's good to know! :)

I was more worried about the fact that there might be a "better" way to do it (i.e. in the same way that you don't call "becomeFirstResponder" on an NSResponder, you call the makeFirstResponder method of NSWindow... but then again, NSResponder doc insist that you *never* call becomeFirstResponder directly under any circumstance, while NSToolbar's doc only "suggest" that you shouldn't call it directly in most cases)


From what I can tell though, there seems to be no other way to do it...

On 20-Nov-08, at 1:35 PM, Peter Ammon wrote:


On Nov 20, 2008, at 9:26 AM, Jean-Nicolas Jolivet wrote:

I have to disable all toolbar items during a long process... I did it basically by overriding

- (BOOL)validateToolbarItem:(NSToolbarItem *)toolbarItem
{
        return !longProcessIsRunning;
}

So that everything is disabled when my process is running, however, once the process is done, the toolbar items are still disabled until I somehow click on one of them... only then they become enabled again...

So I found out that using
validateVisibleItems

Was forcing the re-validation of the items, and making them available when I need them to be... however, the docs clearly state that this method should not be invoked directly... therefore, I am wondering if there is a better alternative to force the re- validation of my items?? Should I just ignore the doc since it's working and this is a particular case?

It's OK to call this method directly. The docs and header say you typically do not call it directly to make it clear that it is called on your behalf after window update events. If you have something that changes the valid state of your toolbar items that is not associated with a window update event (such as a long running process finishing), then your situation is atypical so the "typically..." admonition doesn't apply to you.

-Peter


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to