• 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: Stuck in basic bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Stuck in basic bindings
      • From: Camillo Lugaresi <email@hidden>
    • Re: Stuck in basic bindings
      • From: Shawn Erickson <email@hidden>
References: 
 >Stuck in basic bindings (From: Francis Derive <email@hidden>)
 >Re: Stuck in basic bindings (From: Miguel Sanchez <email@hidden>)
 >Re: Stuck in basic bindings (From: Francis Derive <email@hidden>)
 >Re: Stuck in basic bindings (From: Camillo Lugaresi <email@hidden>)

  • Prev by Date: Re: New titanium interface available to Cocoa developers?
  • Next by Date: CORE DATA: timestamping a model object before saving
  • Previous by thread: Re: Stuck in basic bindings
  • Next by thread: Re: Stuck in basic bindings
  • Index(es):
    • Date
    • Thread