Cells selection in NSTableView
Cells selection in NSTableView
- Subject: Cells selection in NSTableView
- From: Dinakar Pulakhandam <email@hidden>
- Date: Wed, 15 Jul 2009 16:48:26 +0530
Hi All,
I need following functionality to be implemented in
NSTableView.
"Selecting Multiple cells of single column in
NSTableView".
I subclassed NSTableView and created class TestTableView.
I have done following 3 things.
1)I have overriden mouseDown method
With the help of mouse point, I am getting
currentSelectedColumn and currentSelectedRow.
I am using frameOfCellAtColumn:row: method to determine frame
of selected cell and adding cell's rect to selectedCellsRectArray array.
2)I have overriden highlightSelectionInClipRect: method
I observed that this method will be called for
a) Entire table rect
b) For selected rows rect.
a)
In this case, I am taking each cell rect from
alreadyDrawnCells array and highlighting corresponding rect.
b)
In this case, I am taking intersection of rowRect and
cellRect
If intersection rect is equalTo cellRect, then I am
highlighting cell.
I am adding Highlighted cell's rect to
alreadyDrawnCells array.
3) I created custom class for NSTextFieldCell and overriden following
method
- (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView
*)controlView
{
return nil;
}
Above implementation is working fine, if my application is
active.
If i switch to other app and come back to my App, selection
is not working properly.
Something is going wrong in highlightSelectionInClipRect:
method implementation.
Any help would be appreciated.
Thanks,
Dinakar P
_______________________________________________
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