Advanced?? Bindings Questions
Advanced?? Bindings Questions
- Subject: Advanced?? Bindings Questions
- From: Joseph Jones <email@hidden>
- Date: Mon, 27 Sep 2004 13:05:48 -0700
(Note: Please cc me on all responses as I do not receive list email
directly)
Hi all,
I have been trying to learn the Bindings architecture in Panther by creating
a sample application and following the tutorials in the documentation.
Unfortunately, while I can get the simple tutorial stuff working there are
some things I am trying to do that don't seem to have a good solution. I am
not even sure they are do-able as I am trying to do them.
Source code for this question can be had at
http://www.jtechsoftworks.com/software/BindPrefs.zip
Setup:
This is a document based application that has a document with 2 mutable
arrays: Items and Categories. Items is an array of Item instances and
Categories is an array of strings. In my MyDocument.nib file I have declared
a window with a table view to display item information and two buttons to
add/remove items. There are two NSArrayController instances, one for Items
and one for Categories. All of this works as expected.
In my MainMenu.nib I have declared two panels that I wish to be global and
to track the currently selected item and to provide a means of modifying the
category list for a document. The category panel is attached to an
NSArrayController that is attached to the
NSApplication.mainWindow.document.categories. The info panel is not hooked
up at this time.
Both panels are connected to the Main Menu under Window. This allows me to
directly hook the menu to makeKeyAndOrderFront: and not have to code
anything at all.
I am trying to do all this using just the Bindings framework and as little
code as possible (0 if I can get away with it!).
Issues:
1) The Category editor works on a display basis only. I have added Add and
Remove buttons which appear to work. Remove removes the currently selected
item. Add adds a new, blank, string to the list as expected. However, when I
edit the string to change it to something I want, the edit appears to be
ignored and I have no idea why.
2) How do I get the Item Info panel hooked up to the active documents Items
NSArrayController so that I can get it's currently set selection? If I just
hook to the mainWindow.document.items list all I get is the first item since
that list has no means of tracking selection (a job handled by the
NSArrayController instance).
Now, I can move the Item Info panel to the document nib, but I lose any way
of connecting my Main Menu to the panel directly and thus kinda defeats the
purpose of what I am trying to do.
So, can anyone here help me with these issues? Maybe I am smoking crack and
I just can't do what I want to do, but it seems that this should be
possible. There is nothing here that I am doing that is going beyond the
bonds of bindings that I can figure out.
Thanx,
Joe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden