• 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: Capturing mousedown in WebFrameView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Capturing mousedown in WebFrameView


  • Subject: Re: Capturing mousedown in WebFrameView
  • From: glenn andreas <email@hidden>
  • Date: Fri, 29 Jul 2005 09:42:06 -0500


On Jul 28, 2005, at 9:34 PM, Victor Tran wrote:


--- glenn andreas <email@hidden> wrote:



On Jul 28, 2005, at 9:23 AM, Victor Tran wrote:


Ok I've made my own simple browser using the

WebKit

tools. WebView seems to capture mousedowns just

fine

(before a page is loaded), but once a page is

loaded

into the webview, the mousedowns are no longer
captured - I just used an NSLog to check.

Now I figure it could be because the webview has
actually created a WebFrameView to load the

webpage

into. I've read a bit about poseAsClass, but I

still

haven't got that to work.

Any suggestions on how I can go about doing this?


What are you trying to accomplish? Because WebKit has a boatload of delegate methods that it calls for all sorts of things which may accomplish exactly what you're trying to do...


Glenn Andreas email@hidden <http://www.gandreas.com/> wicked fun! Widgetarium | the quickest path to widgets




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.

So as near as I understand things, once a web page is loaded, a bunch of views are built up inside the WebView to show the actual content (i.e., there will probably be a WebHTMLView embedded within your WebView). It's important to realize that in Cocoa, hits automatically are routed to the "deepest" descendant of a view - so by having that embedded view, your super view doesn't get the mouseDown - the subview it is in does. So the first step is to override your hitTest: routine, but be careful about altering how mouse handling works with WebViews, because attempting to alter things can cause problems (since there's a lot of book keeping that goes on within the WebHTMLView and the bridge to KHTML, and if the events no longer happen in "normal" order because you've intercepted mouseDown: bad things can happen). As long as you're just detecting them, there shouldn't be a problem.




Glenn Andreas                      email@hidden
 <http://www.gandreas.com/> wicked fun!
Widgetarium | the quickest path to widgets

_______________________________________________
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


References: 
 >Re: Capturing mousedown in WebFrameView (From: Victor Tran <email@hidden>)

  • Prev by Date: Re: Cocoa runtime VM?
  • Next by Date: NSLayoutManager Background Layout Crash
  • Previous by thread: Re: Capturing mousedown in WebFrameView
  • Next by thread: NSComboBox subclass text field?
  • Index(es):
    • Date
    • Thread