Re: Capturing mousedown in WebFrameView
Re: Capturing mousedown in WebFrameView
- Subject: Re: Capturing mousedown in WebFrameView
- From: Justin Anderson <email@hidden>
- Date: Fri, 29 Jul 2005 09:13:50 -0400
Those are two separate things to a WebView: detecting a button click
and detecting all clicks on a page.
A button click is a navigation action and goes through the WebView's
WebPolicyDelegate if you set one up. You can catch the button clicks
with
webView:decidePolicyForNavigationAction:request:frame:decisionListener:
method, documented at <http://developer.apple.com/documentation/Cocoa/
Reference/WebKit/ObjC_classic/Protocols/WebPolicyDelegate.html#//
apple_ref/doc/uid/20001912-GDIDAHIJ>.
If you want to capture arbitrary mouse coordinates, I would suggest
using a JavaScript function that saves the coordinates of the last
mouseUp. I don't know much JavaScript, but it shouldn't be hard to
find out how to do it. You can get JavaScript variables out of a
WebView with code like this:
id win = [webView windowScriptObject];
id someJSVariable = [win valueForKey:@”someJSVariable”];
More on JavaScript in WebViews at <http://developer.apple.com/
documentation/Cocoa/Conceptual/DisplayWebContent/Tasks/
JavaScriptFromObjC.html#//apple_ref/doc/uid/30001214>
I hope that's been helpful,
Justin Anderson
On Jul 28, 2005, at 10:34 PM, Victor Tran wrote:
Yes I've had a look at the delegate methods and found
things like detecting mouseover. What I need is
something that will detect a button press on a web
page (not necessarily clicking on a link). So the
person can load up a page (which I've done) and click
anywhere in that page and I should be able to detect
those clicks (which I'm trying to do now)
Later I may need to also capture the coordinates of
the mousedown.
_______________________________________________
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