Re: NSString drawAtPoint and vertical font alignment
Re: NSString drawAtPoint and vertical font alignment
- Subject: Re: NSString drawAtPoint and vertical font alignment
- From: Stephen Blinkhorn <email@hidden>
- Date: Mon, 7 Sep 2009 00:38:06 -0600
On 6 Sep 2009, at 21:30, Quincey Morris wrote:
On Sep 6, 2009, at 18:41, Stephen Blinkhorn wrote:
OK, do you mean the origin of [self bounds] isn't always (0, 0)?
That could explain a few things..
The origin of the bounds coordinate system is always (0, 0) by
definition, but what I meant to say was that the bottom left corner
of the view (i.e. [self bounds].origin) doesn't have to be (0, 0) in
bounds coordinates, though it usually is.
Right, here's something I don't understand and I think it is still
relevant:
I make a custom view (really a NSControl subclass) and I use a place
holder in IB to position it on screen. I also set it's size to be say
50 wide by 22 high.
If I draw the view by simply filling the rect returned by [self
bounds] then it looks fine and in the same place as the IB
placeholder. However, the view responds to mouse events outside of
its visual frame at the top edge and only registers mouse events
inside the bottom edge once the cursor is about 3-4 pixels inside the
frame. Whilst only small the inaccuracy feels very wrong after a while.
I don't understand is the mouse event part. I am filling the bounds
rectangle via NSRectFill but mouse events visibly outside the filled
rectangle are apparently happening inside the bounds rectangle. I use
this to get the event position:
NSPoint p = [self convertPoint:[theEvent locationInWindow]
fromView:nil];
I've read a lot of the Apple docs about frames, bounds and co-ordinate
spaces but I can't figure this out. Maye it is time for some sleep.
Thanks,
Stephen
_______________________________________________
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