NSCollectionViewItem Selectable?

Discussion in 'Mac Programming' started by mwxiao, Feb 2, 2010.

  1. mwxiao macrumors regular

    Joined:
    Jul 5, 2007
    Location:
    CT
    #1
    Hi,

    I have a problem about how to use NSCollectionView. I can't select each item in the collection view. I check the box "selectable" in xib. But every time I click the CollectionView, all I can select is actually the Scroll View. No Item in the collection view is selected.

    I check the connection and binding many times and pretty sure they are correct.

    I attached a very simple example to illustrate my problem. Can anyone help me? It drives me crazy...

    zip file:
    http://tinyurl.com/yzvygpl
     
  2. kpua macrumors 6502

    Joined:
    Jul 25, 2006
    #2
    You have to implement the selection highlighting yourself with NSCollectionView. See the IconCollection example to see how you can use an NSBox to do this simply.
     
  3. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #3
    It's working, it's just that your view doesn't draw itself any differently when selected :)

    Create a text field and bind its value to the array controller's selection.@count and you'll see it update.
     
  4. mwxiao thread starter macrumors regular

    Joined:
    Jul 5, 2007
    Location:
    CT
    #4
    Thank you. But I still can't get the NSBox working...

    I changed the prototype view to NSBox, and tried to draw a box background on the item I clicked. But nothing happens...

    Can you take a look at the updated version?

    http://tinyurl.com/yanzgev
     

Share This Page