• 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: WebView Mouse Events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Using NSUserDefaultsController with radio buttons
  • Next by Date: Re: Superimpose a NSTextField over NSImageView?
  • Previous by thread: Re: WebView Mouse Events
  • Next by thread: Printing resolution problems
  • Index(es):
    • Date
    • Thread