Re: Help on Cocoa Class references
Re: Help on Cocoa Class references
- Subject: Re: Help on Cocoa Class references
- From: Uli Kusterer <email@hidden>
- Date: Tue, 18 Jan 2011 17:06:43 +0100
On Jan 18, 2011, at 4:27 PM, Leanne Attard wrote:
> I am developing a java application displaying a window, and then i am taking its native part to draw onto it using openGL, the native part gives me a NSView pointer. I am able to draw onto it however not able to get mouse/key events appropriately. I am using a category for NSView to override acceptFirstResponder method and other mouse events related methods.
I think that's the wrong way to go about it. If I undertand things right, what you should really be doing is create a new NSOpenGLView subclass, instantiate that, and than make that a subview of your "native part" using -addSubview:. In that class you can then simply override the proper methods, just like with any other NSView, without weird surprises.
Using categories to override methods is generally not a good practice, as the behaviour is in many cases quite indeterministic.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
_______________________________________________
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