• 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
Programatically selecting items in a NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Programatically selecting items in a NSTableView


  • Subject: Programatically selecting items in a NSTableView
  • From: Damien Cooke <email@hidden>
  • Date: Mon, 16 Feb 2009 07:57:40 +1030

Hi All,
I have a NSTableView in a dialogue box (NSPanel subclass) I am passing in a value that I want to be the item that is selected when the dialogue opens.


I fully populate the Datasource Array then I do this

//select the item passed in
for(unsigned arrayCounter = 0; arrayCounter < [diaMediaItemsArray count]; arrayCounter++)
{
if([(DCOViewItem *)[diaMediaItemsArray objectAtIndex:arrayCounter] keyID] == itemToSelect)
{
[diaItemsTableView selectRowIndexes:[NSIndexSet indexSetWithIndex: (unsigned)arrayCounter] byExtendingSelection:NO];
}
}



This does not work and I was wondering if
1: can I programatically select an item in a NSTableView?
2: have I done something stupid?
3: This is part of the init of the NSPanel subclass should it be somewhere else (awakeFromNib does not work either).


Thanks
Damien


"We act as though comfort and luxury were the chief requirements of life, when all that we need to make us happy is something to be enthusiastic about."


-- Albert Einstein




_______________________________________________

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


  • Follow-Ups:
    • Re: Programatically selecting items in a NSTableView
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: I like the addition of "Related Sample Code" sections to Cocoa Docs.
  • Next by Date: Re: Testing C functions using OCUnit
  • Previous by thread: Re: I like the addition of "Related Sample Code" sections to Cocoa Docs.
  • Next by thread: Re: Programatically selecting items in a NSTableView
  • Index(es):
    • Date
    • Thread