Re: NSTableView selecting text within a cell
Re: NSTableView selecting text within a cell
- Subject: Re: NSTableView selecting text within a cell
- From: Ross Carter <email@hidden>
- Date: Mon, 31 Jan 2011 11:41:37 -0500
On Jan 31, 2011, at 12:30 AM, Ben Golding wrote:
> I have an app with a NSTableView where the data is presented to the user. When the user hits "Find", I'd like to be able to scroll the table view to the visible cell (easy enough) and then select the range that matched within that field (not so easy).
>
> At present, my code looks like:
>
> NSCell *cell = [csvTableView preparedCellAtColumn:col row:row];
> NSText *textEditor = [csvWindow fieldEditor:YES forObject:cell];
>
> NSLog(@"Match: row %@, field %@, range(%d, %d)", [match row], [match field], [match range].location, [match range].length);
> [csvTableView scrollRowToVisible:row];
> [csvTableView scrollColumnToVisible:col];
> [textEditor setSelectedRange:[match range]];
>
> I feel like I need to between getting the textEditor for the window and calling -setSelectedRange:, I just don't know what.
Sounds like a case for selectWithFrame:inView:editor:delegate:start:length:
_______________________________________________
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