Re: Problem in populating the cells with Images on a one by one basis
Re: Problem in populating the cells with Images on a one by one basis
- Subject: Re: Problem in populating the cells with Images on a one by one basis
- From: "Alastair J.Houghton" <email@hidden>
- Date: Fri, 4 Jul 2003 11:04:32 +0100
On Thursday, July 3, 2003, at 11:55 pm, Ben Dougall wrote:
you need to set up a helper object - this is a separate object that
holds the information, and has the appropriate and connecting methods
to and from the nsmatrix object.
[snip]
No, NSMatrix doesn't work like NSTableView or NSBrowser; NSMatrix
contains an array of NSCell objects, each of which has to know how to
draw itself (possibly by asking another object for data, possibly by
caching data it's been given from elsewhere.
On Thursday, July 3, 2003, at 03:11 pm, Poornima Ranganath wrote:
I have a matrix of NSButtonCells in a NSSCrollView.
These button cells are generated dynamically in one
class & must be associated with images whose
information is held by a function in ANOTHER class.
This function holds info of only ONE image at any
given point of time[This function too gets teh image
info dynamically].
These cells are associated with images only after the
COMPLETE generation of the matrix is done.
I need to populate the matrix cell by cell, how do i
do this?
[snip]
It's pretty easy to set-up an NSMatrix of NSImageCells; something like
this
NSMatrix *myMatrix; /* Probably an outlet of your dialog's controller
class */
/* Resize the matrix to fit the right number of elements */
[myMatrix renewRows:numRows columns:1];
[myMatrix sizeToCells];
/* Fill-in each cell */
for (row = 0; row < numItems; ++row) {
NSImageCell *cell = [myMatrix cellAtRow:row column:0];
[cell setImage:[otherObject getNextImage]];
}
should do the trick. (otherObject is the other object that you talk
about that allows retrieval of the images).
Kind regards,
Alastair.
_______________________________________________
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.