• 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
Synthesizing mouse click events on a hidden WebView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • SOLVED: Synthesizing mouse click events on a hidden WebView
      • From: Keli Hlödversson <email@hidden>
  • Prev by Date: Re: NSString initWithBytes
  • Next by Date: dyld CoreData failure on 10.3 Systems (Gracefully failing on unsupported OS version)
  • Previous by thread: Trouble with NSNumberFormatter Behavior in 10.4
  • Next by thread: SOLVED: Synthesizing mouse click events on a hidden WebView
  • Index(es):
    • Date
    • Thread