In my application, i need to display toolbars items, Initially all the items should be disabled and on a particular action it should be enabled, To do so, i am calling following function,
-(void)disableToolBarItems{
NSArray *pToolbarItems=[ptoolbar visibleItems];
for(int i = 0; i <[pToolbarItems count];i++){
NSToolbarItem *pItem = [pToolbarItems objectAtIndex:i];
[pItem setEnabled:NO];
}
}
-(void)enableToolBarItems{
NSArray *pToolbarItems=[ptoolbar visibleItems];
for(int i = 0; i <[pToolbarItems count];i++){
NSToolbarItem *pItem = [pToolbarItems objectAtIndex:i];
[pItem setEnabled:YES];
[pItem validate];
}
// [ptoolbar setNeedsDisplay:YES];
[ptoolbar validateVisibleItems];
}
Both the methods are hitting at proper place and seems to be correct, but toolbar buttons are not getting enabled, Should i call some other method to enable and disable it ?