Re: Dynamically Updating NSToolbarItem
Re: Dynamically Updating NSToolbarItem
- Subject: Re: Dynamically Updating NSToolbarItem
- From: j o a r <email@hidden>
- Date: Thu, 23 May 2002 22:37:33 +0200
Where is this code snippet from? It seems like it might be from the toolbar delegate method used to provide the toolbar items, this method is only called once for each toolbar item - when it is created. You should look at the documentation for "NSToolbarItemValidation" in the AppKit docs. If you implement toolbar item validation through that mechanism (it's very easy) you can most definitely have the type of dynamic updates you are looking for.
If I was wrong, and your code snippet was from your toolbar validation method, then you should do two things: 1) Check if the validation code is ever called and if so 2) check why the "state" method on the drawer returns the wrong state value. Drawers usually work as expected - does it misbehave in any other way?
j o a r
On Thursday, May 23, 2002, at 18:11 Europe/Stockholm, Albert Atkinson wrote:
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.
_______________________________________________
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.