Re: Handling mouse events in a WebView
Re: Handling mouse events in a WebView
- Subject: Re: Handling mouse events in a WebView
- From: Robert Borsuk <email@hidden>
- Date: Fri, 19 Sep 2003 13:23:49 -0400
Hi All,
Figure I would answer myself in case anyone has tried this madness.
I got WebView to subclass. Make sure you have the WebKit framework in
the project first (always good to run an initial compile). Add your
webview in IB (once it understands) and then subclass.
I can't really say what subclassing got me. It can pick up one first
mouseDown event BEFORE content loads. After that, forget it. No mouse
events go to the subclass.
I ended up putting a transparent window on top of the WebView window so
I can get the mouse events I needed.
Maybe it's just me but I think that Apple has a bit more to go on
WebKit. I've been trying to scale the content by changing the bounds
of the webview (I posted this problem to the WebKit list) but it
whoomps up the subviews and they no longer resize.
Any thoughts or comments are greatly appreciated.
Rob Borsuk
email@hidden
On Wednesday, September 17, 2003, at 01:07 PM, Robert Borsuk wrote:
Hi All,
I've been beating my head on this one. I've combed both the
cocoamasm archives and the Webkit archives in search of answer, but I
can't seem to locate what I need.
Here's the problem:
I have a window with a webview. The webview takes up the entire
window. I would like to be able to get mouse events for mouse up,
mouse down, and mouse drag.
Here's what I have so far:
I have subclassed the window but mouse events aren't being called in
there.
I made my controller a WebUIDelegate for the webview. I can now get a
mouseDidMoveOverElement event but it doesn't seem to be able to tell
me mouse up, down, etc .
I thought I would be clever and in the mouseDidMoveOverElement event I
would put a
if ([[NSApp currentEvent] type]==NSLeftMouseDown)
{
NSLog(@"mouse down");
}
but this doesn't seem to work.
Oh, I also tried subclassing WebView but that gave me some nasty
errors.
Anyone have any ideas or experience with this kind of thing.
Thanks
Rob Borsuk
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.