Re: Row selection in a TableView
Re: Row selection in a TableView
- Subject: Re: Row selection in a TableView
- From: Jyrki Wahlstedt <email@hidden>
- Date: Fri, 9 May 2003 11:07:52 +0300
Hi,
as this is quite a typical question with tableviews (how do I control
the selection in a tableview?), I have also worked through it:
- one has to use a delegate of the tableview (may be the same object
used as the data source, can be set in IB)
- one can use a cell level edit control. This is what I have done with
mine (this allows editing of the player column in all rows and every
other row otherwise; do not ask why I do this, yet):
- (BOOL)tableView:(NSTableView *)aTableView
shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
if ([[aTableColumn identifier] isEqualToString:@"Player"] ||
(rowIndex % 2 == 0))
return YES;
else
return NO;
}
or as in NSTableView documentation delegate method (this answers your
question directly, in this case you always return NO):
tableView:shouldSelectRow:
- (BOOL)tableView:(NSTableView *)aTableView
shouldSelectRow:(int)rowIndex
Returns YES to permit aTableView to select the row at rowIndex, NO to
deny permission. The delegate can implement this method to disallow
selection of particular rows.
HTH,
On torstai, touko 8, 2003, at 16:53 Europe/Helsinki, Suman Ganguly
wrote:
Hi,
In my application I'm using a TableView. I want that when the user
click on
a row of that TableView it will not be selected. That means I want the
row
selection off. I could make the rows non-editable.
Any kind of help would be appriciated.
Thanks,
Suman
_______________________________________________
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.
!
! Jyrki Wahlstedt
! Sammonkatu 10 B 13 mob. +358-40-502 0164
! FI-87100 Kajaani
!
! Our life is no dream; but it ought to become one and perhaps will.
_______________________________________________
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.