Re: transformers? revisited but getting there..
Re: transformers? revisited but getting there..
- Subject: Re: transformers? revisited but getting there..
- From: Tod Cunningham <email@hidden>
- Date: Mon, 20 Sep 2004 02:41:36 -0400
You could definitely use a two way transformer to do this, but as as
you mentioned the transformer would be an issue if you don't know the
mapping of clientnames to clientcodes without the database query. You
could also query the arraycontroller to get the selected object and
then extract the clientcode yourself:
CLLogEntry *contact = [[logArrayController selectedObjects]
objectAtIndex:0];
int code = [contact clientcode];
This assume your arraycontroller returns an object of type CLLogEntry,
but just use whatever class arraycontroller is mapped to return (such
as NSMutableDictionary. You can then get the selected clientcode and
do whatever you want with it.
Remember to bind the contentArray of the controller:
[logArrayController bind:@"contentArray" toObject:logBook
withKeyPath:@"logEntryList" options:nil];
Hope that helps a little, you could also easily do a one way transform
from CLLogEntry to int (code) if that helps you!!!
- Tod
On Sep 19, 2004, at 12:32 PM, Theodore Petrosky wrote:
I need some help with transforms and bindings.
a little history:
I have a popup managed by an arraycontroller. the
array is created by querying a database and retrieving
a list of clientnames and clientcodes. I then bind the
clientnames to the popup. my problem is that when I
change the popup, I need the clientcode to be updated
in the selection.loggedInByCode in the main
controller.
I have used NSTransformers for this before however I
don't know how to get the transform values into the
transformer.
The question is, am I barking up the wrong tree with
using the transformerValues.
Is there an easier way to bind the clientNamePopUp in
such a way that if I select a new clientname, the
clientcode gets updated also.
my 'schema' is like this.
mainJobArray =
jobNumber
clientNmae
clientCode
loggedindate
proofdate
finaldate
the popupcontroller is bound to:
clientname
clientcode
where I am displaying the clientname in the popup.
This array is created on the fly from the database and
can change so I can not create a transformer that is
hard coded.
Am I clear? How can I accomplish this?
Ted
_______________________________
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now.
http://messenger.yahoo.com
_______________________________________________
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
_______________________________________________
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