• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTableView: cell frame coordinates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView: cell frame coordinates


  • Subject: Re: NSTableView: cell frame coordinates
  • From: Mike Ferris <email@hidden>
  • Date: Thu, 12 Dec 2002 17:22:16 -0800

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.
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSTableView: cell frame coordinates
      • From: Ian Gillespie <email@hidden>
References: 
 >NSTableView: cell frame coordinates (From: Ian Gillespie <email@hidden>)

  • Prev by Date: Re: BezierPath Madness...
  • Next by Date: Re: NSData
  • Previous by thread: NSTableView: cell frame coordinates
  • Next by thread: Re: NSTableView: cell frame coordinates
  • Index(es):
    • Date
    • Thread