Bindings Problem
Bindings Problem
- Subject: Bindings Problem
- From: John McLaughlin <email@hidden>
- Date: Thu, 5 Jan 2006 15:27:20 -0800
have a (Odd?) problem with bindings that is driving me crazy...
Let's say I have a class called 'A' with a member variable (NSString*)
called 'status'
If I bind a NSTextField to A.status all is good.... as I update my 'status'
variable programatically it propogates to the UI and if I change the
NSTextField by 'typing into it' it propogates down to the 'status'
varible... so I know it's bound OK.
Now let's say my object 'A' contains a object 'B' and and now 'B' contains
the member variable (NSString*) called 'status'
If I bind my NSTextField to A.B.status I can 'type' into the NSTextField and
it properly propogates down to the 'status' member variable in 'B' (So I
know it's bound properly)
However If I programatically change 'B' the UI never updates......
My work around is ugly right now.... I create getter and setter in 'A' for
the variable (getStatus, setStatus:(NSString*)) that's only job in life is
to set or query the 'B' object (I don't store it locally in A) and I post a
notification in the 'B' object when 'status' updates so that 'A' object can
catch it and perform [self setStatus:[self getStatus]] so that the UI
properly updates.
It works but it's sooooo ugly....
So my question is:
1. Is this somehow expected behaviour (e.g. bindings only work one way
for objects in objects)?
2. Is there a way I can post a notification in 'B' that the bound
value will notice something has changed? (thus avoiding making 'A' get
involved)... E.G. is it documented anywhere what should get posted and
could I throw this manually (via my code)
3. ?? Anything else I should know
It's so frustrating because when bindings work they are tremendous but this
problem is really making them almost not worth it since I'm being forced to
write a lot of code to propoate everything to the 'A' object which is sort
of defeating the purpose....
Regards,
-John
_______________________________________________
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