Re: WebView Mouse Events
Re: WebView Mouse Events
- Subject: Re: WebView Mouse Events
- From: Jonathan Monroe <email@hidden>
- Date: Sun, 23 Apr 2006 22:04:29 +0200
On Apr 22, 2006, at 6:02 PM, email@hidden wrote:
I would like to able to override the mouseDown method for a WebView,
however, I have discovered that this method does not exist with a
WebView.
I had a similar need to filter out right clicks in web view content in
order to prevent the context menu from being displayed. For some
reason, returning nil from contextMenuItemsForElement blocked the
context menu for regular HTML elements, but not Flash objects. I could
never get an assigned WebUIDelegate to intercept the mouse events,
either.
I ended up sub-classing the NSWindow containing my WebView with the
following method:
- (void)sendEvent:(NSEvent *)theEvent
{
int controlKeyDown = [theEvent modifierFlags] & NSControlKeyMask;
// filter out the right clicks
if (([theEvent type] == NSLeftMouseDown && controlKeyDown) ||
[theEvent type] == NSRightMouseDown)
NSLog(@"right click filtered");
else
[super sendEvent:theEvent];
}
Jonathan Monroe
Actual Technologies - ODBC for OS X
http://www.actualtechnologies.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden