• 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: NSString drawAtPoint and vertical font alignment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString drawAtPoint and vertical font alignment


  • Subject: Re: NSString drawAtPoint and vertical font alignment
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 7 Sep 2009 00:09:54 -0700

On Sep 6, 2009, at 23:38, Stephen Blinkhorn wrote:

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];

There's not enough information here to suggest an answer. Is there a placeholder view that you *replace* with a NSControl subclass? Is this a subclass of NSControl directly, or of a specific control (e.g. NSButton)?


You'll probably need to post some code to get an answer, but it's not even clear which code.

I'd suggest you start by putting a breakpoint on the line after the line you showed above, and then start poking around the view hierarchy until you find out what numbers aren't what you expect them to be. It could be a coordinate system snafu, or it could be something more intimately related to control behavior.


_______________________________________________

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


  • Follow-Ups:
    • mouseDown Event Position Accuracy (was: NSString drawAtPoint and vertical font alignment)
      • From: Stephen Blinkhorn <email@hidden>
References: 
 >NSString drawAtPoint and vertical font alignment (From: Stephen Blinkhorn <email@hidden>)
 >Re: NSString drawAtPoint and vertical font alignment (From: Quincey Morris <email@hidden>)
 >Re: NSString drawAtPoint and vertical font alignment (From: Stephen Blinkhorn <email@hidden>)
 >Re: NSString drawAtPoint and vertical font alignment (From: Quincey Morris <email@hidden>)
 >Re: NSString drawAtPoint and vertical font alignment (From: Stephen Blinkhorn <email@hidden>)

  • Prev by Date: Re: Turn on zombies in user environment?
  • Next by Date: Re: Turn on zombies in user environment?
  • Previous by thread: Re: NSString drawAtPoint and vertical font alignment
  • Next by thread: mouseDown Event Position Accuracy (was: NSString drawAtPoint and vertical font alignment)
  • Index(es):
    • Date
    • Thread