Scenarios I don't know how to use Bindings in
Scenarios I don't know how to use Bindings in
- Subject: Scenarios I don't know how to use Bindings in
- From: Seth Willits <email@hidden>
- Date: Fri, 9 Feb 2007 21:29:51 -0800
First off, I'm a bindings newb. I've read about them, played with
some tutorials etc, and I generally get them, but I still can't
figure out how to use them in cases that are non-trivial. Here are
some simple things (to me) that I can't figure out how to do:
1) The first thing is managing the enabled state of a Remove button
for a list. Every bindings tutorial has one, and not a single
tutorial demonstrates how this should be done! Do I still need to use
a table delegate, or can I actually bind the enabled port (what's the
right name for this?) of the button to the array controller's
selection? I've tried that, and it never works.
2) Currently I have a FileTypesManager object which manages an array
(and some other structures) of FileType objects. The glue code in my
preferences controller displays the file types in a table view, and
then allows them to be edited. Before adding a new file type, I first
display a sheet to get some critical values from the user. When
deleting, there's also a confirmation sheet. So how can I do the same
thing with bindings?
My attempt was to set up an array controller which was bound to the
preference's object's -fileTypes method (which just called through to
get the array from the FileTypesManager). I can easily get the file
types displaying in the table, but how do I handle adding and remove
them? If I just use my existing code, it works other than that the
table doesn't reload properly. If I add a new file type, the table
still shows the same number of file types (so the last one is cut
off). All of the examples I've seen just set the button actions
directly to the controller's -add and -remove actions. I can't allow
the fileTypes array to be manipulated directly because the
FileTypesManager has to manage some other related structures (it
needs to add/remove the file types into a few other arrays based on
some simple logic). What can I do?
There are other scenarios I, but I'll hold off on them until I get a
handle on these. It really sucks to _still_ not fully understand how
to use these things after all this time. I want to figure this out
for good!
Thanks,
--
Seth Willits
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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