• 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: 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


  • Follow-Ups:
    • Re: Stuck in basic bindings
      • From: Francis Derive <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>)

  • Prev by Date: Re: Bindings don't populate dialog fields?
  • Next by Date: Re: "Open dialogue"-like file system browser
  • Previous by thread: Re: Stuck in basic bindings
  • Next by thread: Re: Stuck in basic bindings
  • Index(es):
    • Date
    • Thread