• 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: Quartz Bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quartz Bindings


  • Subject: Re: Quartz Bindings
  • From: Jay Kickliter <email@hidden>
  • Date: Mon, 29 Dec 2008 17:21:27 -0500

Matt, thanks. This suggestion worked:

[patchController setValue[NSNumber numberWithFloat:pitch] forKeyPath:@"patch.pitch.value"]

The strange thing is that I tried something almost identical to this that didn't work. I can't remember what I did, but your idea is working great.

Next step is to figure out where all the memory leaks are. I'm processing 20 - 40 strings/sec coming in over a a serial port.

On Dec 27, 2008, at 12:43 PM, Matt Long wrote:

Jay,

I have much more experience using the Core Animation QCCompositionLayer where much of this is abstracted, but here are a few ideas that might help your situation.

- Are you certain that you can bind to your AppController or does it have to be a Cocoa control? I don't know why you couldn't but if you read the tech note closely, they are referring specifically to binding to Cocoa controls programmatically.

- You could explicitly call [patchController setValue[NSNumber numberWithFloat:pitch] forKeyPath:@"patch.pitch.value"] in your setter.

- Do you have to set this up programatically? The instructions here http://tinyurl.com/8lo3og show you how to use Interface Builder to achieve the same thing. You can then create an outlet to the controller for access in your code.

Here's a demo app I did to try to experiment a bit: http://www.cimgf.com/files/QCViewBindings.zip

Best Regards,

-Matt




On Dec 27, 2008, at 8:28 AM, Jay Kickliter wrote:

Thanks Matt,

That's what I tried, but it doesn't work. I'm not using a QCCompositionLayer. Just a QCView and QCPatchController. Here's the code I'm using.

From AppController's AwakeFromNib:

NSMutableDictionary* options;
options = [NSMutableDictionary new];
[options setObject:[NSNumber numberWithBool:NO] forKey:@"NSConditionallySetsEnabled"];
[options setObject:[NSNumber numberWithBool:NO] forKey:@"NSRaisesForNotApplicableKeys"];
[self bind:@"pitch" toObject:patchController withKeyPath:@"patch.pitch.value" options:options];
[self bind:@"roll" toObject:patchController withKeyPath:@"patch.roll.value" options:options];
[options release];


The setter's and getters:

- (void)setPitch:(float)ptch
{
	pitch = ptch;
}

- (float)pitch
{
	return pitch;
}

- (float)roll
{
	return roll;
}

- (void)setRoll:(float)rll
{
	roll = rll;
}

It has a weird behavior in that if I bind an NSSlider to the patch, the sphere rotates as it's supposed to. Also, if I bind AppController's pitch and roll at the same time, they get updated when the NSSlider moves. But, if I call AppController's setPitch and setRoll directly, the QC patch's pitch and roll values do not get updated.


On Dec 26, 2008, at 11:49 PM, Matt Long wrote:

The quartz composition key paths are going to be:

@"patch.pitch.value"
@"patch.roll.value"

If you are using a QCCompositionLayer, you can simply call [layer setValue:[NSNumber numberWithFloat:pitch] forKeyPath@"patch.pitch.value"] or even more simply [layer setValue:[NSNumber numberWithFloat:pitch] forInputKey@"pitch"].

If you are using a QCView and a Patch Controller, then you'll need to look at this: http://developer.apple.com/technotes/tn2005/tn2146.html

HTH,

-Matt



On Dec 24, 2008, at 7:08 AM, Jay Kickliter wrote:

I have a quartz patch with two inputs, "pitch" and "roll". I read through the quartz bindings tutorial, and I'm able to bind NSSliders to the inputs with no problem. But I don't want to bind the inputs to UI elements. I need to bind them to two floats in my AppController, also called "pitch" and "roll". I can't seem to figure out how to bind a Quartz Controller to my AppController. The documentation doesn't tell me anything either. Any ideas?

Jay
_______________________________________________




_______________________________________________

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


References: 
 >Quartz Bindings (From: Jay Kickliter <email@hidden>)
 >Re: Quartz Bindings (From: Matt Long <email@hidden>)

  • Prev by Date: outlineViewSelectionDidChange not always being called on remove
  • Next by Date: Re: Overriding NSHTTPCookieStorage for WebView
  • Previous by thread: Re: Quartz Bindings
  • Next by thread: [NSWindow initWithWindowRef] limitations
  • Index(es):
    • Date
    • Thread