Missing Mouse Events in PDFView
Missing Mouse Events in PDFView
- Subject: Missing Mouse Events in PDFView
- From: Alexander Griekspoor <email@hidden>
- Date: Wed, 31 Oct 2007 10:51:06 +0000
Hi,
Is it me or does it no longer work to subclass mouse events in
PDFView? mouseDown is called correctly in my subclass, but after that
I never receive mouseDragged and the mouseUp events. This poses
serious problems for what worked fine under Tiger (showing a menu
upon mouseUp). Is there a workaround or someway to know when the
user stopped selecting? I now kind of resort to listening to the
setCurrentSelection method with a cancel and delayed timer each time
this changes, but it's far from optimal.
Also, now I use the lower right corner of the currentselection as the
popup point for a menu, however I have difficulties getting the menu
to popup at the right spot.
This is what I have now:
// get the point where we wish to popup
NSRect selectionRect = [[self currentSelection]boundsForPage: [self
currentPage]];
NSPoint popupPoint = NSMakePoint(NSMaxX(selectionRect), NSMinY
(selectionRect));
popupPoint = [self convertPoint: popupPoint fromPage: [self
currentPage]];
// create a new event
NSEvent *currentEvent = [NSApp currentEvent];
NSEvent *click = [NSEvent mouseEventWithType: NSLeftMouseUp
location: popupPoint
modifierFlags:[currentEvent modifierFlags]
timestamp:[currentEvent timestamp]
windowNumber:[currentEvent windowNumber]
context:[currentEvent context]
eventNumber:0
clickCount:0
pressure:0.5];
[NSMenu popUpContextMenu: selectionMenu withEvent: click forView: self];
Unfortunately this never pops up the menu at the right location,
usually in the origin of the window or somewhere else in the pdfview.
Any help is greatly appreciated!
Cheers,
Alex
_______________________________________________
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