• 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: Victor Tran <email@hidden>
  • Date: Fri, 5 Aug 2005 00:20:49 +1000 (EST)

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

>
> 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
>
>

I am a new to cocoa, as you would have probably
imagined.
Could you please elaborate on what you mean by
overriding the hitTest: routine since I don't actually
have one. Did you mean overriding it in a subclass of
webview?

All I want to do is be able to detect it for now
anyway. So I was thinking of intercepting the
mouseDown with an imposter class and just do an NSLog
and then i can hand it over to the super class to do
the rest.

something like:

- (void)mouseDown:(NSEvent *)theEvent
{
	NSLog(@"Mouse clicked");
	[super mouseDown:theEvent];
}

Thanks for all your help.

Victor



____________________________________________________
Do you Yahoo!?
Yahoo! Photos: Now with unlimited storage
http://au.photos.yahoo.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: Basic instinct
  • Next by Date: Re: Basic instinct
  • Previous by thread: Re: 256x256 Icons
  • Next by thread: Forcing a scroll to the top of an NSScrollView
  • Index(es):
    • Date
    • Thread