FROM : I. Savant
DATE : Tue Aug 15 23:19:42 2006
Jerrod:
> I have created a class that inherits off of NSView. It does some
> special things that I need it to do. We will call this viewB. I
> have another Custom view that I created in IB. We will call this
> viewA. When viewA gets created, I manually create a bunch of
> viewB's. So far I have been able to get each of them to draw
> individually.
>
I think you need to step back and re-think your approach. Though
I'm not entirely sure what you're doing exactly and there's some key
information you're leaving out, I suspect you're doing way more work
than you have to.
For anything laid out in an even grid in Cocoa, you'll almost
always want to use NSMatrix or a subclass. For what you're ultimately
trying to achieve (which you've failed to mention) you very likely
don't even have to subclass NSMatrix. You could most likely achieve
your goal by subclassing NSActionCell (or one if its subclasses) and
telling your NSMatrix to manage that custom cell. NSMatrix will
handle the tiling and creating of cells for you for free. That alone
is worth spending a few minutes learning to use it.
You'll want to read all relevant documentation:
http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaFundamentals/CoreAppArchitecture/chapter_7_section_6.html
http://developer.apple.com/documentation/Cocoa/Conceptual/Matrix/
index.html#//apple_ref/doc/uid/10000022i
http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/Classes/NSMatrix_Class/Reference/Reference.html
http://developer.apple.com/documentation/Cocoa/Conceptual/
EventOverview/EventArchitecture/chapter_2_section_4.html
http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/Classes/NSActionCell_Class/Reference/Reference.html
This may also prove invaluable in your understanding:
http://www.cocoadev.com/index.pl?DragMatrix
(more follows)
> Basically I am creating a grid that I want each square to handle
> it's own event. I already create an array of each of the pointers
> to the viewB's in memory so that I can access them. So far, the
> viewB class has it's own mouseDown event and it overrides
> acceptsFirstResponder. This doesn't seem to be good enough since
> viewB gets created dynamically a bunch of times. So then I
> discovered that since it's being created dynamically, it needs to
> somehow respond to the NSResponder chain. Also, I discovered that
> in order for each individual viewB to get close to the event, viewA
> must accepts events, --->At least that is what the NSResponder
> architecture is telling me. So,,
>
> I need the ability to bypass viewA and somehow subscribe each viewB
> to the "main" responder chain. This means that I don't want to
> accept mouse events (I can to some degree) and then determine where
> the user clicked and then grab a handle to the instance of that
> viewB and send the event to that. Any help would be appreciated. -
> Jerrod Fowkes
>
This last bit has me confused. I'm tired, so I may be missing your
point, but I stand by the advice above. I think you need a matrix of
custom cells but more importantly, to read the documentation.
--
I.S.
>
> ---------------------------------
> Stay in the know. Pulse on the new Yahoo.com. Check it out.
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/idiotsavant2005%
> 40gmail.com
>
> This email sent to <email_removed>
DATE : Tue Aug 15 23:19:42 2006
Jerrod:
> I have created a class that inherits off of NSView. It does some
> special things that I need it to do. We will call this viewB. I
> have another Custom view that I created in IB. We will call this
> viewA. When viewA gets created, I manually create a bunch of
> viewB's. So far I have been able to get each of them to draw
> individually.
>
I think you need to step back and re-think your approach. Though
I'm not entirely sure what you're doing exactly and there's some key
information you're leaving out, I suspect you're doing way more work
than you have to.
For anything laid out in an even grid in Cocoa, you'll almost
always want to use NSMatrix or a subclass. For what you're ultimately
trying to achieve (which you've failed to mention) you very likely
don't even have to subclass NSMatrix. You could most likely achieve
your goal by subclassing NSActionCell (or one if its subclasses) and
telling your NSMatrix to manage that custom cell. NSMatrix will
handle the tiling and creating of cells for you for free. That alone
is worth spending a few minutes learning to use it.
You'll want to read all relevant documentation:
http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaFundamentals/CoreAppArchitecture/chapter_7_section_6.html
http://developer.apple.com/documentation/Cocoa/Conceptual/Matrix/
index.html#//apple_ref/doc/uid/10000022i
http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/Classes/NSMatrix_Class/Reference/Reference.html
http://developer.apple.com/documentation/Cocoa/Conceptual/
EventOverview/EventArchitecture/chapter_2_section_4.html
http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/Classes/NSActionCell_Class/Reference/Reference.html
This may also prove invaluable in your understanding:
http://www.cocoadev.com/index.pl?DragMatrix
(more follows)
> Basically I am creating a grid that I want each square to handle
> it's own event. I already create an array of each of the pointers
> to the viewB's in memory so that I can access them. So far, the
> viewB class has it's own mouseDown event and it overrides
> acceptsFirstResponder. This doesn't seem to be good enough since
> viewB gets created dynamically a bunch of times. So then I
> discovered that since it's being created dynamically, it needs to
> somehow respond to the NSResponder chain. Also, I discovered that
> in order for each individual viewB to get close to the event, viewA
> must accepts events, --->At least that is what the NSResponder
> architecture is telling me. So,,
>
> I need the ability to bypass viewA and somehow subscribe each viewB
> to the "main" responder chain. This means that I don't want to
> accept mouse events (I can to some degree) and then determine where
> the user clicked and then grab a handle to the instance of that
> viewB and send the event to that. Any help would be appreciated. -
> Jerrod Fowkes
>
This last bit has me confused. I'm tired, so I may be missing your
point, but I stand by the advice above. I think you need a matrix of
custom cells but more importantly, to read the documentation.
--
I.S.
>
> ---------------------------------
> Stay in the know. Pulse on the new Yahoo.com. Check it out.
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/idiotsavant2005%
> 40gmail.com
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Jerrod Fowkes | Aug 15, 21:55 | |
| I. Savant | Aug 15, 23:19 | |
| Erik Buck | Aug 16, 01:44 | |
| Jerrod Fowkes | Aug 16, 14:58 | |
| I. Savant | Aug 16, 15:01 | |
| Jerrod Fowkes | Aug 16, 16:17 | |
| Uli Kusterer | Aug 16, 17:44 |






Cocoa mail archive

