Re: Not able to hide or prevent user selection of NSButtonCells created in NSMatrix.
Re: Not able to hide or prevent user selection of NSButtonCells created in NSMatrix.
- Subject: Re: Not able to hide or prevent user selection of NSButtonCells created in NSMatrix.
- From: Saratchandra Kongara <email@hidden>
- Date: Fri, 25 Apr 2003 10:08:51 -0400
Hello John,
I had a similar problem before. I didn't find a delegate method that
can tell NSMatrix whether to display the cell in question. Here is code
from my project.
[addEntryPhotoPanel_albumView renewRows:newRows columns:3];
[addEntryPhotoPanel_albumView sizeToCells];
// display the images in the matrix cells
cells = [addEntryPhotoPanel_albumView cells];
for(i = 0; i < [cells count]; i++) {
if(i < [addEntryPhotoSearchDataSource count]) {
[[cells objectAtIndex:i] setEnabled:YES];
[[cells objectAtIndex:i] setImage:[[[NSImage alloc]
initByReferencingFile:[[addEntryPhotoDataSource objectAtIndex:i]
objectForKey:@"thumbPath"]] autorelease]];
} else {
[[cells objectAtIndex:i] setEnabled:NO];
[[cells objectAtIndex:i] setImage:nil];
}
}
addEntryPhotoPanel_albumView is the NSMatrix
newRows is calculated based on the number of images you like to show (
Rows X Columns)
The extra cells in the last row are displayed and a nil image is
assigned.
Hope this helps.
Regards
Sarat
On Friday, April 25, 2003, at 09:01 AM, John Desuza wrote:
>
Hi,
>
>
I am dynamically creating a mattrix with NSButtonCells
>
for displaying thumbnails.The matrix I have created is
>
restricted to show only 4 columns. the thumbnails are
>
also displayed correctly.
>
The application does this much correctly. The problem
>
is when there are odd no of images to be displayed.
>
So when there are odd number of images to be
>
displayed, some cells are blank and i am able to
>
select those empty cells also.
>
>
Is there any way to hide the empty cells and also
>
prevent the user from selecting these cells.
>
>
Thanks.
>
>
with rgds,
>
johnd
>
The New Yahoo! Search - Faster. Easier. Bingo
>
http://search.yahoo.com
>
_______________________________________________
>
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.
_______________________________________________
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.