Re: List of Images like in System Preferences + General NSMatrix issue
Re: List of Images like in System Preferences + General NSMatrix issue
- Subject: Re: List of Images like in System Preferences + General NSMatrix issue
- From: Shawn Erickson <email@hidden>
- Date: Wed, 28 Jan 2004 10:21:54 -0800
On Jan 28, 2004, at 9:18 AM, Michael Becker wrote:
There are several ways to do this, but one is to start with an
NSImageView (from the palette in IB), and then Alt+Drag it to make a
NSMatrix of NSImageCells.
Okay, thank you. That worked nicely. Now I have a problem which is
more of an NSMatrix-specific thing:
Unlike in the System Preferences, I want to be able to select one
(ideally more than one) of my displayed images. Then click a button
and have these pictures passed on to my main application. (All of this
is supposed to be a sophisticated "open"-dialog).
I am not very familiar with NSMatrix and I have no clue how to
implement the above. Highlighting does not seem to work the way I'd
like it to and I can implement the target/action mechanism, but I
don't know how to get the cell I clicked.
What should I try to do?
Docs do cover this, for a start...
<
http://developer.apple.com/documentation/Cocoa/Conceptual/Matrix/
index.html>
I believe you want to use "NSListModeMatrix" mode for the matrix and
use selectedCells to get the users selection when they click the
button. You can understand what cell is what by sending it a "tag"
message among other possible ways (I would make the tag your image file
name or some type of key that can be used to look up the image).
If you have a dynamic number of images your will likely have to create
the matrix programmatically instead of using IB to define an archive
the matrix.
-Shawn
_______________________________________________
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.