• 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: NSPopupButton as pulldown, image problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPopupButton as pulldown, image problems


  • Subject: Re: NSPopupButton as pulldown, image problems
  • From: Dave Batton <email@hidden>
  • Date: Sun, 15 Apr 2007 10:41:36 +0200

Jesus,


The problem I'm having is that the image is moved slightly to the right instead of being drawn at an x position of 0.

How can I solve this? Do I need to subclass NSPopupButton?

Yes. Then override -drawRect: to draw the image yourself.


How can I change the image when the user clicks on the button and revert back when the user stops clicking on it?

Override -mouseDown: and set a BOOL instance variable to track the mouse-down state (which you'll check in -drawRect:), then call [self display] (and don't forget [super mouseDown:theEvent]).


Next, override -menuDidEndTracking: to toggle your BOOL back to the not-down state. No call to -display is needed here, the button will already be getting another call to -drawRect: automatically.


I'll try to update my Apple Mail-style interface demo with this type of button later today or tomorrow:


<http://www.mere-mortal-software.com/blog/details.php?d=2006-12-21>


-- Dave Batton Mere Mortal Software http://www.Mere-Mortal-Software.com/blog/


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >NSPopupButton as pulldown, image problems (From: Jesus De Meyer <email@hidden>)

  • Prev by Date: Re: Best way to implement filtering in large Data Set
  • Next by Date: Re: Convert NSXMLDocument to a NSDictionary?
  • Previous by thread: NSPopupButton as pulldown, image problems
  • Next by thread: NSAttributedString attribute stylesheet
  • Index(es):
    • Date
    • Thread