Re: NSTableView: cell frame coordinates
Re: NSTableView: cell frame coordinates
- Subject: Re: NSTableView: cell frame coordinates
- From: Ian Gillespie <email@hidden>
- Date: Thu, 12 Dec 2002 17:48:39 -0800
Thanks Mike, that is what I needed.
On Thursday, Dec 12, 2002, at 17:22 US/Pacific, Mike Ferris wrote:
>
You cannot really use the view conversion API between views in
>
different windows, and even if you could, you still wind up with
>
window-based coords, not screen. I would try something more like:
>
>
- (void)textDidChange {
>
>
if ([myTableView editedColumn]==6) {
>
NSPoint origin =[myTableView frameOfCellAtColumn:6
>
row:[myTableView selectedRow]].origin;
>
>
// Convert to window coords
>
origin = [myTableView convertPoint:origin toView:nil];
>
// Convert to screen coords
>
origin = [[myTableView window] convertBaseToScreen:origin];
>
>
[notesWindow setFrameOrigin:origin];
>
>
[myParentWindow addChildWindow:notesWindow
>
ordered:NSWindowAbove];
>
[notesWindow makeFirstResponder:nil];
>
}
>
}
>
>
>
Begin forwarded message:
>
>
> From: Ian Gillespie <email@hidden>
>
> Date: Thu Dec 12, 2002 11:36:49 AM US/Pacific
>
> To: email@hidden
>
> Subject: NSTableView: cell frame coordinates
>
>
>
> Ok, I want to make it so that each time a cell in a certain column of
>
> a
>
> table column is edited, a little window with an NSTextView in it pops
>
> up just below the edited cell.
>
>
>
> Here is what I have done so far. I have subclassed NSWindow to make a
>
> window borderless and without a top bar. I also have it so that when
>
> the right cell is edited my custom window appears, but it appears in
>
> the wrong spot. I am still learning about coordinates, so hopefully
>
> someone can tell me what is wrong with this code. This is what gets
>
> called, when the text begins editing:
>
>
>
> - (void)textDidChange {
>
>
>
> if ([myTableView editedColumn]==6) {
>
>
>
> NSRect aRect =[myTableView frameOfCellAtColumn:6 row:[myTableView
>
> selectedRow]];
>
>
>
> aRect = [myTableView convertRect:aRect toView:notesView];
>
> //notesView
>
> is my NSTextView in my custom window
>
>
>
>
>
> NSPoint origin = NSMakePoint(aRect.origin.x, aRect.origin.y);
>
> [notesWindow display]; //this is my custom window with NSTextView
>
> in it
>
> [notesWindow setFrameOrigin:origin];
>
>
>
>
>
> [myParentWindow addChildWindow:notesWindow ordered:NSWindowAbove];
>
> [notesWindow makeFirstResponder:nil];
>
> }
>
> }
>
>
>
> Can someone please lend a hand to a newbie trying to do things he
>
> doesn't know how to do?
>
> Thanks,
>
> Ian
>
> _______________________________________________
>
> 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.
>
>
>
___________________________
Ian G. Gillespie
Dept. of Botany & Plant Sciences
University of California
Riverside, CA 92521
http://student.ucr.edu/~gillei01
___________________________
_______________________________________________
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.