Programatically selecting items in a NSTableView
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