[SOLVED] Re: NSToolbarItem setImage problems
[SOLVED] Re: NSToolbarItem setImage problems
- Subject: [SOLVED] Re: NSToolbarItem setImage problems
- From: Jeffrey J Barbose <email@hidden>
- Date: Sun, 25 Apr 2004 18:45:23 -0700
Seems that no matter how i tried to hold onto a ref to the
NSToolbarItem, it would be a copy.
So had to do this:
NSArray* toolbarVisibleItems = [[[self window] toolbar] visibleItems];
NSEnumerator* enumerator = [toolbarVisibleItems objectEnumerator];
NSToolbarItem* anItem = nil;
BOOL stillLooking = YES;
while ( stillLooking && ( anItem = [enumerator nextObject] ) )
{
if ( [[anItem itemIdentifier] isEqualToString:@"myIdentifierString"] )
{
[anItem setImage:newImage];
[anItem setLabel:newLabel];
stillLooking = NO;
}
}
Just FYI.
On 2004, Apr 25, at 18.19, Jeffrey J Barbose wrote:
>
I'm trying to dynamically change the image and label of an
>
NSToolbarItem using setImage: and setLabel: , when the option key is
>
held down.
>
>
i've overridden flagsChanged: to detect the state of the option key
>
(pressed or not), and call thru to a function which calls setImage:
>
>
the code gets hit, the image that needs to be set is the correct one
>
for each state, and setImage is called.
>
same thing for the label.
>
>
i've added NSLog's to report what the NSToolbarItem says it's
>
displaying, and that agrees with what is supposed to be there.
>
>
The trouble is that the image and the label never get updated in the
>
UI. I can't find any API for forcing a redraw.
>
>
I've read that others have this kind of thing working..and i've seen
>
it work in iPhoto with the rotate image item.
>
>
Any help would be appreciated.
>
>
jeff
>
>
>
>
>
>
god of biscuits speaks!
>
--------------------------------------
>
http://blog.godofbiscuits.com
>
_______________________________________________
>
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.