NSToolbar setConfigurationFromDictionary: ?
NSToolbar setConfigurationFromDictionary: ?
- Subject: NSToolbar setConfigurationFromDictionary: ?
- From: Dan Saul <email@hidden>
- Date: Sat, 17 Jul 2004 17:56:16 -0500
Hi, I'm currently trying to change the content of an NSToolbar at
will, I've tried removing all the items (snippet 1), but that did not
work, I am currently working on a configuration dictionary (snippet
2), but i haven't had much luck with that either. Can someone look at
my code and tell me what I am doing wrong, or one that points to a
tut. using a configurationDictionary? Thanks in advance!
Snippet 1:
// Get number of items in toolbar
NSArray * itemsInToolbar = [[mainWindow toolbar] items];
NSLog([NSString stringWithFormat:@"%@", itemsInToolbar ]);
unsigned int c = [itemsInToolbar count];
NSLog([NSString stringWithFormat:@"%i", c ]);
// Remove all items
int i;
for(i=0;i<c;i++) {
[[mainWindow toolbar] removeItemAtIndex:i];
}
Snippet 2:
NSMutableDictionary * grItems;
[grItems setObject:[[NSArray alloc] initWithObjects:
@"Game",
@"GetList",
@"Reload",
@"Servers",
@"ServerRoom",
@"Favorites",
@"Chat",
@"Filter",
@"AddFavorite",
@"RemoveFavorite",
NSToolbarSeparatorItemIdentifier,
NSToolbarFlexibleSpaceItemIdentifier, nil] forKey:@"TB Display Mode"];
[[mainWindow toolbar] setConfigurationFromDictionary:grItems];
_______________________________________________
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.