Dynamically Updating NSToolbarItem
Dynamically Updating NSToolbarItem
- Subject: Dynamically Updating NSToolbarItem
- From: Albert Atkinson <email@hidden>
- Date: Thu, 23 May 2002 11:11:08 -0500
Hello!
I have an NSToolbarItem that will show and hide an NSDrawer. What
I would like is when the drawer is open it will display the close
icon and text but when the drawer is closed it will display the
open icon and text. Here is the code I have:
else if([itemIdent isEqual: SpeechDocToolbarItemIdentifier]) {
if ([speechDrawer state]==NSDrawerClosedState) {
[toolbarItem setLabel: @"Show Speech"];
[toolbarItem setPaletteLabel: @"Speech"];
[toolbarItem setToolTip: @"Show Speech Drawer"];
[toolbarItem setImage: [NSImage imageNamed: @"Show
Speech Panel"]];
} else if ([speechDrawer state]==NSDrawerOpenState) {
[toolbarItem setLabel: @"Hide Speech"];
[toolbarItem setPaletteLabel: @"Speech"];
[toolbarItem setToolTip: @"Hide Speech Drawer"];
[toolbarItem setImage: [NSImage imageNamed: @"Close
Speech Panel"]];
}
// Tell the item what message to send when it is clicked
[toolbarItem setTarget: speechDrawer];
[toolbarItem setAction: @selector(toggle:)];
}
This code does not seem to work as all it shows is "Show Speech
Drawer" with the open icon no matter what state it is in.
Anyone have any suggestions?
Thanks!
Albert
_______________________________________________
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.