Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Bindings

Bindings
Thread Tools
3R1C
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Mar 6, 2005, 07:14 AM
 
I have just completed the transition from delegate based tableViews to bindings/NSArrayController based tableViews and I must say im pretty much sold on bindings. Heres the question i have about bindings. Is it possible to bind an NSButtons "enabled-ness" to an NSTextFields "NSIsNotNil-ness".
3R1C
     
Catfish_Man
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Mar 6, 2005, 04:25 PM
 
Have a look at NSValueTransformer, it could do what you want:

http://developer.apple.com/documenta...ansformer.html
     
3R1C  (op)
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Mar 6, 2005, 06:20 PM
 
Yes I looked at transformers. but what would I hook what up to what? An NSObjectController? I totally understand doing tables with NSArrayController, and instinctively, I know it would be a breeze to hook up a buttons enabled to a textfields isnotnil. But for the life of me I cant wrap my mind around it.
3R1C
     
techtrucker
Senior User
Join Date: Feb 2003
Location: USA
Status: Offline
Reply With Quote
Mar 6, 2005, 09:35 PM
 
I've been thinking about making the transition to bindings but...I must be getting old and afraid of change, I seem stuck on my old methods of pumping the data back and forth manually. One thing I couldn't figure out was how to use bindings with external data, the apps I'm developing all access Postgres data. The examples from Apple all use generic data classes (Person, etc). I guess the problem is I'm not strictly adhering to the MVC paradigm, I'm mixing some data access code in with the views.
Sorry for being long winded, I clicked on the topic because I'm very interested in bindings but am not sure if they will help me at all. The short version of the question would be: Any idea how to use bindings with external data? And as far as assigning the buttons in IB to add/delete etc. I can't use that at all, I have lots to do when a user hits one of those buttons. Maybe the built in methods can be overriden?
I think I need "Cocoa Bindings for Dummies"
MacBook 2.0 160/2GB/SuperDrive
Lots of older Macs
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Mar 6, 2005, 09:53 PM
 
Cocoa bindings is pretty well linked to MVC design. This is why it's also called the Controller Layer. Apple seems to intend to make MVC design completely automated, IB filling in the View layer, NSController occupying the Controller layer, and CoreData in Tiger supplying the Model layer.

Personally, I've never really been able to get down with Bindings either, though. Working with all the quirks in Bindings seems like more trouble than writing glue code for the simple situations that bindings can handle on its own.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
techtrucker
Senior User
Join Date: Feb 2003
Location: USA
Status: Offline
Reply With Quote
Mar 7, 2005, 08:13 AM
 
Thanks, I'm glad to know I'm not the only one. I'll keep doing things the way I have been, and maybe revisit everything once Tiger is out...
MacBook 2.0 160/2GB/SuperDrive
Lots of older Macs
     
Catfish_Man
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Mar 7, 2005, 03:33 PM
 
Unless you're looking to drop 10.3 support (and it seems a bit early for that), you'd likely be stuck with 10.3-level bindings. I can't see the new features being backwards compatible.
     
3R1C  (op)
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Mar 24, 2005, 08:31 PM
 
So back to the original question. how can I hook up a button's enabled-ness to a textField's isNotNil-ness?
3R1C
     
Catfish_Man
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Mar 24, 2005, 11:36 PM
 
Add a category on NSTextField implementing -(BOOL)isNil;?
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 04:40 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,