Re: Can't receive a scrollWheel message in a PDFView subclass
Re: Can't receive a scrollWheel message in a PDFView subclass
- Subject: Re: Can't receive a scrollWheel message in a PDFView subclass
- From: Raleigh Ledet <email@hidden>
- Date: Fri, 30 Mar 2012 11:16:00 -0700
There is probably a subview that is intercepting the event. You subclass should override hitTest to return self for specific current events so that it gets first crack at the event. See the Target Gallery sample project.
https://developer.apple.com/library/mac/#samplecode/TargetGallery/Introduction/Intro.html#//apple_ref/doc/uid/DTS40008923
-raleigh
On Mar 28, 2012, at 12:53 PM, Nick <email@hidden> wrote:
> Hello
> Sorry for flooding the list with basic questions, but I really don't
> have a big experience with the Cocoa development.
>
> I am delving currently into PDFKit for Mac, trying to display a PDF
> document on a window. I also would like to change default behavior of
> this control (this is a customized application, that should allow
> user draw onto PDF pages, so preserving "natural" PDFView
> functionality is not needed, PDF page is rather treated as a canvas
> for drawing).
> For example, I would like the user to be able to draw a rectangle with
> the right mouse button (instead of displaying context menu), or zoom
> in/out the document with the scroll wheel, or "pan" the document (that
> has been zoomed in) with the left mouse button, just like Mac OS
> Preview application does it in its Move mode.
> To achieve this, I have subclassed PDFView class, and tried to
> redefine mouse methods - specifically -rightMouseDown, and
> -scrollWheel.
> It appears none of them is ever called.
>
> As I understand, an event hander for NSView descendant is not being
> called if the container of this view (for example, another view)
> handles the event and doesn't call, for example, [[self nextResponder]
> eventHandlerName:theEvent] (but what is the "superview" for PDFView,
> besides the Content View?)
>
> How could I still react to the events?
> I have been adviced earlier to make my PDFView subclass install Event
> Monitors. Is this the only solution to handle these events? There is
> no "prettier" way?
>
> Thank you
> _______________________________________________
>
> 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
_______________________________________________
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