Enabling Toolbar Buttons...
Enabling Toolbar Buttons...
- Subject: Enabling Toolbar Buttons...
- From: Oliver Cameron <email@hidden>
- Date: Mon, 14 Apr 2003 16:46:08 +0100
Im creating a HTML editor, and have a toolbar with a New button on it,
im a Cocoa newbie and looked in the sample SimpleToolbar code and found
out how the Save button was enabled.
I found this code:
- (BOOL) validateToolbarItem: (NSToolbarItem *) toolbarItem {
BOOL enable = NO;
if ([[toolbarItem itemIdentifier] isEqual:
SaveDocToolbarItemIdentifier]) {
enable = [self isDocumentEdited];
} else if ([[toolbarItem itemIdentifier] isEqual:
NSToolbarPrintItemIdentifier]) {
enable = YES;
} else if ([[toolbarItem itemIdentifier] isEqual:
NewDocToolbarItemIdentifier]) {
enable = YES;
}
return enable;
}
Now, in there is NSToolbarPrintItemIdentifier which I do not need, so I
replaced that with my NewDocToolbarItemIdentifier, yet it is not
enabled when I build, the code for the New Doc item is:
} else if ([itemIdent isEqual: NewDocToolbarItemIdentifier]) {
[toolbarItem setLabel: @"New"];
[toolbarItem setPaletteLabel: @"New"];
[toolbarItem setToolTip: @"Make New Document"];
[toolbarItem setImage: [NSImage imageNamed: @"NewDocumentItemImage"]];
[toolbarItem setTarget: self];
[toolbarItem setAction: @selector(newDocument:)];
I don't see what could be wrong? Thanks!
_______________________________________________
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.