Synthesizing mouse click events on a hidden WebView
Synthesizing mouse click events on a hidden WebView
- Subject: Synthesizing mouse click events on a hidden WebView
- From: Keli Hlödversson <email@hidden>
- Date: Fri, 2 Sep 2005 13:49:26 +0200
I'm using a WebView to render HTML into an texture using
NSBitmapImageRep's -initWithFocusedViewRect: to extract the rendered
view.
I also need to simulate mouse click events on the view in order to
follow links. I've tried to create NSEvent objects and post them to
the web view using -mouseDown: and -mouseUp: like the following code
snippet without luck.
NSGraphicsContext *context = [NSGraphicsContext currentContext];
[theView mouseDown: [NSEvent mouseEventWithType:NSLeftMouseDown
location:NSMakePoint(x,y)
modifierFlags:nil timestamp:GetCurrentEventTime()
windowNumber: 0 context:context eventNumber: 1 clickCount:1 pressure:
1.0]];
[theView mouseUp: [NSEvent mouseEventWithType:NSLeftMouseUp
location:NSMakePoint(x,y)
modifierFlags:nil timestamp:GetCurrentEventTime()
windowNumber: 0 context:context eventNumber: 1 clickCount:1 pressure:
1.0]];
I don't get any errors when I run this and the web view does not
react in any way.
Any ideas how to accomplish this?
--
With kind regards
Keli Hlodversson
The best code obfuscator is a novice programmer
-- Robert Amesz
_______________________________________________
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