Re: NSMatrix NSImageCell binding
Re: NSMatrix NSImageCell binding
- Subject: Re: NSMatrix NSImageCell binding
- From: John Buckley <email@hidden>
- Date: Tue, 3 Jan 2006 13:40:42 +0000
Hi,
I've had a play with this myself and as far as I can tell NSMatrix,
NSImageCell and bindings just don't work together. NSTextFieldCells
bind just fine, but the trouble seems to be that the NSMatrix always
passes an NSString to the cell's setObjectValue method, even if the
cell is an NSImage.
My solution has been to subclass NSMatrix and write my own custom
bindings. That way you can get some layout control too.
Regards,
John
On 12/24/05, Nicolas Berloquin <email@hidden> wrote:
> Hi !
>
> After reading all the discussions around thumbnail matrices, I
> decided to try to implement it with bindings.
> I have in my myDocument (fileOwner) a mutable array of dictionaries,
> with one key 'image' which holds
> an NSImage.
> I created an arrayController that binds to fileOwner._thumbsArray
> (the array of dictionaries).
> My NSMatrix's content is bound to the controler with the model key
> path set to 'image'.
>
> I load each NSImage with [[NSImage alloc] initWithContentsOfFile:
> curFile]
>
> then, create a dictionary, add that image to it, then add the dico to
> the array :
>
> NSImage *tmpImage = [[NSImage alloc] initWithContentsOfFile: curFile];
> NSMutableDictionary *newDico = [NSMutableDictionary
> dictionaryWithObjectsAndKeys:tmpImage, @"image", newCell, @"cell", nil];
> [self insertObject: newDico in_thumbsArrayAtIndex:[self
> countOf_thumbsArray]];
>
> but, as soon as I do the insertObject, I get the following error :
> NSImageCell's object value must be an NSImage.
>
> I logged everythings, and the image is really an NSImage.
> (The reason I put the image inside a dictionary is because I read a
> hint here about kvc compliance and
> dictionaries, I tried with a 'pure' array of NSImages and I had the
> same errors).
>
> I really don't see what I'm doing wrong !
>
> any help would be appreciated ^_^ thanks !
>
> PS I also read about reducing the image's size for thumbs, but I keep
> this for when the first part works...
>
> _______________________________________________
> 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
>
_______________________________________________
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