• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Missing Mouse Events in PDFView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Missing Mouse Events in PDFView


  • Subject: Re: Missing Mouse Events in PDFView
  • From: John Calhoun <email@hidden>
  • Date: Wed, 31 Oct 2007 10:47:43 -0700

On Oct 31, 2007, at 3:51 AM, Alexander Griekspoor wrote:
Is it me or does it no longer work to subclass mouse events in PDFView?

It's not you.

I didn't realize this would break anyone....

Most of AppKit in fact don't use the -[mouseDragged] and -[mouseUp] events for tracking. As of Leopard, neither does PDF Kit.

It turns out that, for tracking in any event, a lot of state has to be kept (instance vars) in order to handle dragging or tracking across the three event flavors. So what PDF Kit does now is:

// Track the mouse while down.
while ((nextEvent = [[self window] nextEventMatchingMask: NSLeftMouseDraggedMask | NSLeftMouseUpMask]))
{
NSPoint viewMouse;
NSPoint pageMouse;

// Get mouse in page coordinates.
viewMouse = [self convertPointFromBase: [nextEvent locationInWindow]];
pageMouse = [self convertPoint: viewMouse toPage: page];

// Handle mouse tracking.

// When the mouse is let up, we are done.
if ([nextEvent type] == NSLeftMouseUp)
{
// Break out of mouse tracking loop.

break;
}
}


PDF Kit may have a bug though since I would nonetheless expect you to get your mouse up event. I'm thinking PDF Kit is swallowing the mouse up event in it's while loop (above).

A workaround might be to subclass mouseDown and post your own mouseUp event at the tail of your method after calling -[super mouseDown:] if on Leopard.

Does this help?

I apologize again for not anticipating this.

john calhoun—

_______________________________________________

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


  • Follow-Ups:
    • Re: Missing Mouse Events in PDFView
      • From: Alexander Griekspoor <email@hidden>
    • Re: Missing Mouse Events in PDFView
      • From: Murat Konar <email@hidden>
References: 
 >Missing Mouse Events in PDFView (From: Alexander Griekspoor <email@hidden>)

  • Prev by Date: Re: reordering table cells with 10.5 sdk
  • Next by Date: Re: Missing Mouse Events in PDFView
  • Previous by thread: Re: Missing Mouse Events in PDFView
  • Next by thread: Re: Missing Mouse Events in PDFView
  • Index(es):
    • Date
    • Thread