• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSMatrix Multi-Select
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMatrix Multi-Select


  • Subject: Re: NSMatrix Multi-Select
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 30 Jan 2008 09:22:24 -0600

Looking at the class docs, there's some ambiguity about the meaning of "selected cell(s)". It seems that NSMatrix really only ever has one selected cell. All of the other cells that you think of as selected are actually just "highlighted". See the discussion for the selectedCells method. It directly addresses your question.

In short, to add a single cell to the selection, call -[NSMatrix highlightCell:atRow:column:].

If you need to change the selected cell but not alter the set of "selected" cells, you'd need to save (copy) the result of selectedCells, select the single cell you want, then iterate over the previously selected cells and re-highlight them.

-Ken

On Jan 30, 2008, at 1:21 AM, Jiva DeVoe wrote:

Small update - I did find setSelectionFrom:to:anchor:highlight which seems not to deselect the previous selection, but all this still feels like a big nasty hack... so I'm still asking... is there a better way to do what I want to do?


On Jan 30, 2008, at 12:01 AM, Jiva DeVoe wrote:

So I did a lot more research on this today...

And it turns out, it looks like NSMatrix IS multi-select by default. The problem comes from the same issue this guy ran into:

http://www.cocoabuilder.com/archive/message/cocoa/2003/12/15/89691

Specifically, he wanted to implement drag and drop support (so do I) - which from the looks of that email, means I have to implement mouseDown: and then manually call selectCellAtRow:column. The problem then is that selectCellAtRow:column appears to *deselect* any previously selected cells, which means basically that by implementing his solution for drag and drop, it basically breaks multi-selection.

SO... I looked to see if I could find any methods that explicitly said they do NOT deselect the previously selected cells, and I couldn't find any. Can anyone suggest a good way to do this?

Again, what I want is an NSMatrix which allows multi-selection AND drag-and-drop.

On Jan 29, 2008, at 8:02 AM, Jiva DeVoe wrote:

Hi,

I have a custom view which I have inherited from NSMatrix. Is there an easy built-in way to make NSMatrix be allow multi- selection? Or do I need to do some kind of hackery for it?

Thanks

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSMatrix Multi-Select (From: Jiva DeVoe <email@hidden>)
 >Re: NSMatrix Multi-Select (From: Jiva DeVoe <email@hidden>)
 >Re: NSMatrix Multi-Select (From: Jiva DeVoe <email@hidden>)

  • Prev by Date: Re: NSTextField value binding and button click
  • Next by Date: Named image for regular folder?
  • Previous by thread: Re: NSMatrix Multi-Select
  • Next by thread: Re: [Leopard] Creating shared NSOpenGLView, Core Animation backed
  • Index(es):
    • Date
    • Thread