|
|
Bindings
|
|
|
|
Mac Enthusiast
Join Date: Oct 2001
Status:
Offline
|
|
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
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Aug 2001
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Oct 2001
Status:
Offline
|
|
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
|
|
|
|
|
|
|
|
Senior User
Join Date: Feb 2003
Location: USA
Status:
Offline
|
|
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
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
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'."
|
|
|
|
|
|
|
|
Senior User
Join Date: Feb 2003
Location: USA
Status:
Offline
|
|
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
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Aug 2001
Status:
Offline
|
|
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.
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Oct 2001
Status:
Offline
|
|
So back to the original question. how can I hook up a button's enabled-ness to a textField's isNotNil-ness?
|
3R1C
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Aug 2001
Status:
Offline
|
|
Add a category on NSTextField implementing -(BOOL)isNil;?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|