Re: NSMatrix NSImageCell binding
Re: NSMatrix NSImageCell binding
- Subject: Re: NSMatrix NSImageCell binding
- From: Nicolas Berloquin <email@hidden>
- Date: Sun, 8 Jan 2006 20:19:02 +0100
thanks !
(sorry about the delay in replying, but I ended up thinking no one
would reply :D)
Thanks for the suggestion, I'll try by subclassing, and see if it helps.
On 3 janv. 06, at 14:40, John Buckley wrote:
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:
email@hidden
This email sent to email@hidden
----------------------------------------------
saru mo ki kara ochiru
_______________________________________________
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