Re: Value With Pattern binding not working as expected
Re: Value With Pattern binding not working as expected
- Subject: Re: Value With Pattern binding not working as expected
- From: George Orthwein <email@hidden>
- Date: Tue, 5 Jun 2007 15:05:04 -0400
On Jun 4, 2007, at 7:45 AM, Sam Stigler wrote:
Display Pattern: The current browser store contains %{value1}@
browse nodes.
Multiple Values Placeholder: The current browser store is empty.
No Selection Placeholder: The browser store is currently selected.
Not Applicable Placeholder: The current browser store is empty.
Null Placeholder: The current browser store is empty.
It looks like the Display Pattern is used regardless of placeholders,
so you are always going to get that string with whatever value
plugged in. The four Placeholder strings modify the value for special
cases. So they will get plugged into the Display Pattern in place of %
{value1}.
I'm writing to ask, do I have those placeholders typed in
correctly? Do I need to add any special C-string-style characters
(e.g., % or @) to them for them to behave as expected? The reason
I ask is that the binding behaves exactly as expected if I pass it
an NSNumber of 3, but if I pass it a NULL value (as I do in my -
awakeFromNib method) I get the following result:
The current browser store contains The current browser store is
empty. browse nodes.
Here the Null Placeholder string is correctly replacing %{value1} in
the Display Pattern string.
Which of course is very odd. If pass in an [NSNull null] instead,
I get:
The current browser store contains <null> browse nodes.
Since [NSNull null] is an object, the Null Placeholder is not triggered.
And when I tried the null placeholder string itself (because I was
desperate), that didn't work either:
The current browser store contains NSNullPlaceholder browse nodes.
I guess here the value was the actual string "NSNullPlaceholder" so
no placeholders were triggered and it got plugged into the Display
Pattern string correctly.
I'm guessing the best solution for what you want to do is create your
own Value Transformer and don't use the Display Pattern binding
option (or placeholders). That way you can completely replace the
entire text string as you see fit.
Hope that helps,
George
_______________________________________________
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