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

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


  • Subject: Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
  • From: Graham Cox <email@hidden>
  • Date: Tue, 3 Nov 2009 21:07:29 +1100


On 03/11/2009, at 8:48 PM, Oleg Krupnov wrote:

As I said, I am trying to refresh the state of the view after a
lengthy operation is complete.

No disrespect, but you did not say that - this is the first mention of a "lengthy operation". How lengthy? What is it?. Not sure why the coyness but if you want help you have to be helpful.



By "state" I mean that the item in the
view on which the mouse is hovered, should highlight.

Why not just tell the view to sort itself out when the "lengthy operation" completes? Just send it a message and implement whatever you need to do to fix it up.



Also, if I don't
refresh, the view will not respond to the following mouse down event,
unless it is preceded with another mouse move event (because the view
only respond to clicks if there is a highlighted item).

Well, that doesn't sound right. Are you sure there isn't some other bug causing that?


There are
multiple views of different kind

What kind? Are they custom views of your own design? In which case you can do whatever you want, you are not constrained by the architecture of controls or other built-in views.



in the window, each with its own kind
of state. I'd like the currently hovered view to refresh its state, as
if it received a regular mouse move event. I thought imititating the
mouse move event would be the most straightforward and simple way. Was
I wrong?

Hard to be sure without seeing any code, but on the face of it, yes, I think this is wrong. You normally don't need to post events to make things happen. There is a situation where you might need to post a mouse-up if you are implementing your own tracking loop inside a view that expects mouse down/move/up events and the mouse up is expected to balance the mouse down and your inner tracking loop has already swallowed it, but those cases are pretty unusual and it doesn't sound like yours is like that.


How are you doing the hovering? Using NSTrackingArea (or tracking rects) is a good solution - trying to trap & dispatch mouse events in a loop is not.

--Graham

_______________________________________________

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: Oleg Krupnov <email@hidden>
References: 
 >How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work... (From: Oleg Krupnov <email@hidden>)
 >Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work... (From: Graham Cox <email@hidden>)
 >Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work... (From: Oleg Krupnov <email@hidden>)

  • Prev by Date: Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
  • Next by Date: Re: Linking Back to My CSS File.
  • Previous by thread: Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
  • Next by thread: Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
  • Index(es):
    • Date
    • Thread