• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSToolBar Implementation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSToolBar Implementation


  • Subject: Re: NSToolBar Implementation
  • From: j o a r <email@hidden>
  • Date: Fri, 20 Jul 2001 12:23:54 +0200

On torsdag, juli 19, 2001, at 08:35 , Andreas Monitzer wrote:

Hi Brave Cocoa dev folk! I'm attempting to implement an NSToolbar which I
began with the provided example. My problem is this: My toolbar items are
showing up in the toolbar, yet they are all disabled. I'm calling the
setEnabled method for each toolbar item but they are still dimmed out. I'
m
sure I'm missing some detail. Any ideas, feedback, help, would be much
appreciated.
Try to hook them to some action.

You might also add some toolbaritem validation to your delegate. This is an example that enables toolbar items only when a condition is satisfied (in this case selections in an NSOutlineView):

- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem
{
if ([[theItem itemIdentifier] isEqualToString:@"delete"]) {
if ([myOutlineView numberOfSelectedRows] > 0) {
return YES;
} else {
return NO;
}
}
else if ([[theItem itemIdentifier] isEqualToString:@"reveal"]) {
if ([myOutlineView numberOfSelectedRows] == 1) {
return YES;
} else {
return NO;
}
}
else {
NSLog(@"Unknown toolbar item");
return NO;
}
}


Regards,

j o a r


References: 
 >Re: NSToolBar Implementation (From: Andreas Monitzer <email@hidden>)

  • Prev by Date: Fwd: mouse up/down
  • Next by Date: RE: [Help] How to get instance of instantiated Controller in nib from Controller in another nib? (Java)
  • Previous by thread: Re: NSToolBar Implementation
  • Next by thread: Double-clicking NSOutlineView
  • Index(es):
    • Date
    • Thread