Re: NSPopupButton as pulldown, image problems
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