Re: Scrolling List of Thumbnails?
Re: Scrolling List of Thumbnails?
- Subject: Re: Scrolling List of Thumbnails?
- From: Jerry LeVan <email@hidden>
- Date: Fri, 18 Jun 2004 11:15:22 -0400
I am currently messing with Johns example and found that if I use
radio mode the action triggers.
However I found I had to connect the "ActionImageCell" in IB.
It appears to me that I could not set the action dynamically...
ie
// load images into the thumb array
for(i=0 ; i< fcnt ; i++) {
NSImage * tmp= [[NSImage
alloc]initWithContentsOfFile:(NSString*)[fileNameList
objectAtIndex:i]];
[[thumbArray cellAtRow:i column:0] setImage: tmp];
// [[thumbArray cellAtRow:i column:0] setAction:@selector(showMe:)];
[tmp release];
It made no difference if the commented line was there or not, the action
would not fire *unless* I first connected the cell in IB to the action.
(maybe I don't understand how setAction works.)
However if in my awakeFromNib routine I did
- (void) awakeFromNib
{
fileNameList = [[NSMutableArray alloc] initWithCapacity:10];
[thumbArray setPrototype: [thumbArray cellAtRow:0 column:0]];
}
Then all of the images responed (in a funky way) provided I had
connected the first cell in IB.
The "funky way" was that the "sender" was the NSMatrix and not the cell
-(IBAction)showMe:(id)sender
{
NSLog(@"ShowMe call with %@",sender); <<<<<showed NSMatrix
deleted stuff
}
Which is ok, since I could query the matix and get the cell index
which I use into an array of filenames....
--Jerry
On Jun 18, 2004, at 10:51 AM, email@hidden wrote:
Cc: Cocoa-Dev List <email@hidden>
From: James DiPalma <email@hidden>
Subject: Re: Scrolling List of Thumbnails?
Date: Fri, 18 Jun 2004 03:37:28 -0700
To: John Pannell <email@hidden>
It is quite easy to add the needed functionality (support for
target/action) to a subclass of NSImageCell.
I copied your code into a sample application, added a two-cell matrix
of NSImageCells, set their subclass to ActionImageCell and set this
matrix's mode to highlight.
It did not send actions.
_______________________________________________
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.