FROM : I. Savant
DATE : Thu Jan 03 20:51:23 2008
> 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.
DATE : Thu Jan 03 20:51:23 2008
> 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.
| Related mails | Author | Date |
|---|---|---|
| Nat Edar | Jan 3, 20:46 | |
| I. Savant | Jan 3, 20:51 | |
| Nat Edar | Jan 3, 20:57 | |
| I. Savant | Jan 3, 21:00 | |
| Jean-Daniel Dupas | Jan 4, 09:33 | |
| Nat Edar | Jan 4, 09:52 |






Cocoa mail archive

