Re: NSImageView subclass, setImage, and bindings
Re: NSImageView subclass, setImage, and bindings
- Subject: Re: NSImageView subclass, setImage, and bindings
- From: mmalcolm crawford <email@hidden>
- Date: Sat, 4 Feb 2006 15:57:03 -0800
On Feb 3, 2006, at 2:34 AM, Greg Best wrote:
I've subclassed NSImageView (creating MediaWell) with the goal of
being able to receive QuickTime Movies by drag and drop. For now,
I'm only attempting to display the poster frame as the image.
-(void)setMovie:(QTMovie*)newMovie
{
[movie autorelease];
movie=[newMovie retain];
if(movie)
{
[super setImage:[movie posterImage]];
}
}
This works fine within the MediaWell object-- the poster frame
shows as the image in the NSImageView subclass. The problem is
that the binding isn't being triggered so the image is not being
propogated to the model and other views. I've tried calling
setImage on super and self with no difference in behavior (not that
I'd expect any since I haven't overridden the method).
The setImage: method is probably not used to propagate the image to
the object to which the view is bound. See <http://
developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/
Concepts/HowDoBindingsWork.html>...
If you're using Mac OS X v10.3, then you will need to override
bind:toObject:withKeyPath:options: to capture the binding information
to then send the KVC message on update (when the movie is set); if
you're targeting 10.4, then you can simply use infoForBinding: to
retrieve the necessary information (see <http://homepage.mac.com/
mmalc/CocoaExamples/ClockControl2a.zip> for an example).
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden