Refresh View After Mouse Inactivity
Refresh View After Mouse Inactivity
- Subject: Refresh View After Mouse Inactivity
- From: Richard Charles <email@hidden>
- Date: Sat, 30 Apr 2016 17:08:16 -0600
I have a view that needs to be refreshed after a period of mouse inactivity.
- (void)mouseInactive
{
// This does not work.
[self setNeedsDisplay:YES];
// This does not work. I think this did work at one time but stopped
// working on OS X 10.10 Yosemite.
[self performSelector:@selector(setNeedsDisplay:)
withObject:@YES afterDelay:0.0];
}
- (void)mouseMoved:(NSEvent *)event
{
[NSObject cancelPreviousPerformRequestsWithTarget:self];
[self performSelector:@selector(mouseInactive)
withObject:nil afterDelay:2.0];
}
The problem is that calling setNeedsDisplay: does not work. It appears that the run loop is stopped. Once the user does something like press a key on the keyboard then the view is refreshed.
Does anyone have any ideas?
--Richard Charles
_______________________________________________
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