Re: Disable toolbar items
Re: Disable toolbar items
- Subject: Re: Disable toolbar items
- From: email@hidden
- Date: Thu, 2 Dec 2010 22:48:53 -0700
I went back to removing the items and then removing the object for
NSToolbar key in user defaults at program terminate so the removed
items will be available on next run.
Works great; thanks to all contributors!
-koko
On Dec 2, 2010, at 9:57 PM, John Joyce wrote:
On Dec 3, 2010, at 1:47 PM, email@hidden wrote:
rather that deal with the remove of toolbar items I thought I would
just disable the items with this code:
NSArray *items = [m_toolbar items];
NSEnumerator *e = [items objectEnumerator];
NSToolbarItem *item;
while(item = [e nextObject])
{
NSString *label = [item label];
if(NSOrderedSame == [label compare:@"Merge Stitch File"] ||
NSOrderedSame == [label compare:@"Create Letters"])
{
[item setEnabled:NO];
NSLog(@"disable %@",[item label]);
}
}
I get this log output:
2010-12-02 21:44:04.392 Embrilliance[391:813] disable Merge Stitch
File
2010-12-02 21:44:04.393 Embrilliance[391:813] disable Create Letters
But, the items are still enabled.
So, how does one disable a toolbar item?
-koko
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please read the documentation before posting. The NSToolbar,
NSToolbarItem classes and the NSToolbarItemValidation protocol are
all pretty well documented and clear.
Google also works well. Here is your answer:
http://developer.apple.com/library/mac/#documentation/Cocoa/
Reference/ApplicationKit/Protocols/NSToolbarItemValidation_Protocol/
Reference/Reference.html#//apple_ref/occ/cat/NSToolbarItemValidation
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden