convertPoint:toView: issue
convertPoint:toView: issue
- Subject: convertPoint:toView: issue
- From: Gideon King <email@hidden>
- Date: Thu, 1 Apr 2010 02:44:20 +1000
Hi
I want to put a child window over the top of one of my views. I have a few nested RBSplitViews and I want to get the origin of the contents of one of those split views, but no matter what I do, it seems to come up with strange results.
I have "scrollView" as a subview of one of the RBSplitSubviews:
NSPoint windowPoint = [scrollView convertPoint:[scrollView bounds].origin toView:nil];
NSPoint screenPoint = [[self window] convertBaseToScreen:windowPoint];
NSWindow *childWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(screenPoint.x, screenPoint.y-150.0, 150.0f, 150.0f) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
...
This puts the child window above the top of the scrollview by about 20 pixels. The X edge is at the left edge of my Window, which is where it should be in this case.
I also have another RBSplitSubview beside the first, so I thought I would try with that and see what would happen. It ended up at the left edge of my window (which in this case is wrong), and half way off the bottom of the window - nowhere near where it should be.
Has anyone else experienced strange results from these methods?
Could the split views be messing things up?
I also tried using convertPointToBase, but the results were the same (I'm not sure if there is a difference between convertPointToBase: and convertPoint:toView:nil)
Thanks
Gideon
_______________________________________________
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