• 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
How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...


  • Subject: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
  • From: Oleg Krupnov <email@hidden>
  • Date: Tue, 3 Nov 2009 11:03:10 +0200

Hi,

I'd like to imitate a mouse move event programmaticaly, to refresh the
state of my custom view.

What is the best way to do it?

I am trying to use [NSApp postEvent:atStart:] and [window
postEvent:atStart:], but nothing happens, the event is not fired, and
the view does not receive it.

Here is my code:

	NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved
										location:windowPoint
								   modifierFlags:0
									   timestamp:0
									windowNumber:windowNumber
										 context:nil
									 eventNumber:0
									  clickCount:0
										pressure:0];

	[NSApp postEvent:event atStart:NO];

What am I doing wrong? Thanks!
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
      • From: Dave Keck <email@hidden>
    • Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Handling projects with several XIBs
  • Next by Date: Re: Apple Remote Control Wrapper sends same button ID for all buttons.
  • Previous by thread: Re: [Moderator] Re: Apple Remote Control Wrapper sends same button ID for all buttons.
  • Next by thread: Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
  • Index(es):
    • Date
    • Thread