On Sun, May 11, 2008 at 12:50 PM, Mike <[EMAIL PROTECTED]> wrote: > I have NSTextField which is connected to a slider in IB with its (Sent > Actions = Take Double Value from).
Don't do this. See below. > (Apparently I can't have them both connected to each other AND still have > connection to my controller when either is changed?) Nope. It doesn't make sense to have multiple things connected to one outlet; that's why you have a controller. That said, it does make sense for something to be connected to multiple outlets. > Q: How do I make that reset to reflect to slider too without having another > outlet and do it manually? First you should review some introductory material on model-view-controller. In your setup, this is what you would do: 1. Create a controller object that has an IBAction method. Something like - (void)takeMyValue:(id)sender. 2. Add two outlets to your controller: an NSSlider* and an NSTextField*. 3. Wire up the target/action of both your slider and text field to your controller object's -takeMyValue: method. 4. Wire up the NSSlider and NSTextField outlets of your controller object to their respective views. 5. In -takeMyValue:, send both your slider and text field a -setFloatValue: message with [sender floatValue] as the argument. Here's an example of this pattern so you can see how it plays out: http://cocoadevcentral.com/articles/000045.php Or, instead of writing all this glue code, you can use bindings. Make a KVC-compliant property in your model and bind both the slider and text field to that keypath. No code required. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
