• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Value With Pattern binding not working as expected
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Value With Pattern binding not working as expected


  • Subject: Value With Pattern binding not working as expected
  • From: Sam Stigler <email@hidden>
  • Date: Mon, 4 Jun 2007 21:45:14 +1000

Hi,

I'm sorry to have two questions out there right now, but I've been searching for an answer to this question for hours and can't find one: The problem I'm having is I'm trying to use a "value with pattern" binding on an NSTextField to display status information, and all of the text field's placeholders are filled in. The bindings looks like this:

displayPattern1:
Bind To: DOStatusController (NSObjectController)
Controller Key: content
Model Key Path: nodeCount
No value transformer
Raises for Not Applicable Keys: YES
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.


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.

Which of course is very odd. If pass in an [NSNull null] instead, I get:

The current browser store contains <null> browse nodes.

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'm pretty sure this has something to do with my being new to this binding, and doing something wrong here. I've looked (see below for all of the places), but can't find an example of this binding that uses placeholders.


-Sam



*I can't remember all of the places I've looked, but here are most of them:
-mmalc's Cocoa Bindings Examples page (particularly "Controlled Preferences")
-The archives of this list
-A Google search brought up very few results. One of them was a thread archived on Cocoabuilder from 2003, I think it was. It mentioned this binding, but it was more a cry for help from someone disillusioned with the documentation than a good resource for my problem.
-NSKeyValueObserving Protocol Reference (at developer.apple.com)
-I tried to use the latest (or one of the latest bindings sample projects posted on developer.apple.com -- WithAndWithoutBindings -- but it wouldn't compile. Something about an unrecognized command line option. Then I tried to open its MyDocument.nib, and it couldn't be opened.
-CocoaDev: BindingsInspector
-CocoaDev: BindingQuestions
-I just took a look through the MailDemo code on CocoaDevCentral to see if that uses this binding, but doesn't -- instead, it sets the mailboxes status line manually using -stringWithFormat.



_______________________________________________

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


  • Follow-Ups:
    • Re: Value With Pattern binding not working as expected
      • From: George Orthwein <email@hidden>
  • Prev by Date: OT: WWDC eTicket
  • Next by Date: Recursion taking up far too much memory... any ideas?
  • Previous by thread: OT: WWDC eTicket
  • Next by thread: Re: Value With Pattern binding not working as expected
  • Index(es):
    • Date
    • Thread