Re: How do I trigger IBAction with custom "button" based on NSView...
Re: How do I trigger IBAction with custom "button" based on NSView...
- Subject: Re: How do I trigger IBAction with custom "button" based on NSView...
- From: Nat Edar <email@hidden>
- Date: Thu, 3 Jan 2008 11:57:26 -0800
The subject line may be a little misleading as to what I'm doing--I'm
not really making a traditional button.
I'm making a panel (with a clickable heading) that is part of a
ListViewList/Accordion. In light of that, I need to alert the
accordion controller to animate its subviews to collapse and expand
with animation.
On Jan 3, 2008, at 11:51 AM, I. Savant wrote:
I have an NSView that has custom drawing and "hotspot". I want to be
able to connect it to an IBAction function on my controller. However,
in my hitTest (or mouseDown), I need to somehow trigger any attached
action.
Your problem is that you're fighting the frameworks. Create your own
custom NSButton/NSButtonCell classes, move your drawing routines to
the cell class, and be done with it. It's *not* that much harder and
you get all the free, wonderful things that come with a
much-better-designed UI element than a simple NSView with an
overridden -mouseDown: method could give you.
Oh, and read up on the Target/Action mechanisms in Cocoa.
--
I.S.
_______________________________________________
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