Re: Stuck in basic bindings
Re: Stuck in basic bindings
- Subject: Re: Stuck in basic bindings
- From: Camillo Lugaresi <email@hidden>
- Date: Wed, 18 Jan 2006 20:06:29 +0100
On 17/gen/06, at 22:09, Francis Derive wrote:
I understand that with my implementation of the derived property:
- (float) mouseXlocation {
return [self mouseLocation].x;
}
mouseXlocation should be executed upon - *automatic* -
notification of a change in the value of the property mouseLocation.
Yes, **IF** mouseLocation exists and is key-value observable.
- (void) mouseDown:(NSEvent *)event {
mouseLocation = [self convertPoint:[event locationInWindow]
fromView:nil];
NSLog(@"fdeGradientView -- mouseDown - mouseLocation.x:%f
mouseLocation.y:%f", mouseLocation.x, mouseLocation.y);
NSLog(@"fdeGradientView -- mouseDown - mouseXlocation:%f
mouseYlocation:%f", mouseXlocation, mouseYlocation);
[self setNeedsDisplay:YES];
}
You are not changing mouseLocation in a KVO-compliant way, so it's
normal that change notifications are not being triggered. You can
define a setMouseLocation accessor and call it inside mouseDown, or
bracket direct assignments to the mouseLocation ivar with
willChangeValueForKey:/didChangeValueForKey:.
Camillo
_______________________________________________
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