Re: Stuck in basic bindings
Re: Stuck in basic bindings
- Subject: Re: Stuck in basic bindings
- From: Francis Derive <email@hidden>
- Date: Wed, 18 Jan 2006 22:11:45 +0100
On Jan 18, 2006, at 8:06 PM, Camillo Lugaresi wrote:
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
Camillo,
I feel confused after all my attempts and variations. Let me say :
- mouseLocation always existed as an ivar, and still is, with its
accessors :
- (NSPoint) mouseLocation {
return mouseLocation;
}
- (void) setMouseLocation: (NSPoint) theLocation {
mouseLocation = theLocation;
}
and has always been updated correctly as revealed by mouseDown and
other's NSLog.
- may be you wanted to say that mouseXlocation is not KVO-compliant
and I agree to this, after Miguel correctly mentioned that - for the
mouseXlocation dependent key to be computed, I had not to declare it
as an ivar - and its (KVC) accessors -, but only to make
mouseXlocation a method returning the dependent value - dependent
upon NSPoint mouseLocation.
But, then, I saw a problem because this mouseXlocation was signaled
to be "non KVO" compliant - and I understand it is not KVO compliant
not to even be KVC compliant - when I had bound it to ... ( could be
a model class ivar, or directly to the NSTextField, as I told I am
confused and I have to restart from fresh with my mind ).
By now, I can't only say : I am confused and I have to restart from
fresh with my mind.
Cheers, later.
Francis.
_______________________________________________
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