Re: Bounds of selected NSTableView cell
Re: Bounds of selected NSTableView cell
- Subject: Re: Bounds of selected NSTableView cell
- From: Felix Franz <email@hidden>
- Date: Sun, 08 Apr 2012 18:08:46 +0200
Hi Koen,
you can use NSTableView>>frameOfCellAtColumn:row: to get the frame of the cell at the columnIndex/rowIndex.
The controlView of the cell is the NSTableView-object, and thus you always get the bounds of the table itself.
For the rects of rows/columns you can use rectOfRow:/rectOfColumn:
Cheers,
Felix
On 08.04.2012, at 17:56, Koen van der Drift wrote:
> I am trying to find out what the bounds are of the cell of an NSTableView that was clicked in. I'd like to use that rect to show a NSPopover when the user double clicks on a cell. I have this in my NSTableView controller class:
>
>
> -(IBAction)doubleClickAction:(id)sender
> {
> NSInteger row = [sender selectedRow];
> NSCell *cell = [myTableColumn dataCellForRow: row];
> NSRect cellRect = [[cell controlView] bounds];
>
> [self.myPopover showRelativeToRect: cellRect ofView:sender preferredEdge:NSMaxXEdge];
> }
>
>
> The popover shows up nicely, but always points to the middle of the table, instead of to the cell that was clicked in.
>
> How can I get the bounds of the cell that was clicked in?
>
> Thanks,
>
> - Koen.
>
>
>
>
> _______________________________________________
>
> 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
--
Mit freundlichen Grüßen,
Felix Franz
Lead Software Engineer
ERGOSIGN GmbH
Europa-Allee 12
66113 Saarbrücken
Phone: +49 681 98 84 12 14
Fax: +49 681 98 84 12 10
www.ergosign.de
HRB 11850
Amtsgericht Saarbrücken
Geschäftsführung:
Dr. Marcus Plach
Prof. Dr. Dieter Wallach
Sitz der Gesellschaft:
Saarbrücken
_______________________________________________
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