Re: Cocoa Binding Musings
Re: Cocoa Binding Musings
- Subject: Re: Cocoa Binding Musings
- From: mmalcolm crawford <email@hidden>
- Date: Mon, 10 May 2004 13:26:09 -0700
On May 10, 2004, at 11:11 AM, Craig Hockenberry wrote:
1) How does one localize the placeholder text in the value binding? My
first
guess of it being a key for an entry in Localizable.strings proved
wrong. It
seems unlikely that a German user will want to see "Please enter text"
for a
null placeholder.
You localise this in each localised nib...
Please, though, submit an enhancement request (this is a pet peeve of
mine :-) .
3) It took me forever to figure out what the default value transformers
"NSIsNil", "NSIsNotNil", etc. did. Searching the Reference Library &
Google
turned up nothing. By chance, I stumbled upon "NSIsNilTransformName"
the
other day and it answered my question. Why does the documentation not
match
IB? Why doesn't a search on developer.apple.com not match the "NSIsNil"
pattern?
The constant is NSIsNilTransformName -- it's not really appropriate for
that to appear in IB. The predefined constants are, though, listed in
the constants section of the NSValueTransformer API reference...
<
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
ObjC_classic/Classes/NSValueTransformer.html>
4) If File's Owner in IB is set to NSApplication, and the delegate is
connected to a class that supports KVC, the delegate never gets passed
get/set invocations.
I'm not sure why you think it should?
Obviously, you can work around this by creating a
separate NIB with File's Owner set to your class (alleviating the need
to
have a delegate), but it's a pain for small applications. It seems
like the
delegate should be able to handle the KVC on behalf of NSApplication.
Am I
missing something, or is this a bug?
I think you're missing the point of KVC. And overlooking keypaths; you
can still bind to:
[File's Owner].delegate.whatever
5) Text fields only update user defaults after the user has pressed the
enter key. (It's possible that this is true for other controls -- I
think
I've seen this behavior in table cells.)
This seems like a bug from a HIG point-of-view -- if a user types
"abc" into
a text field and then closes the application, the fact that they typed
"abc"
is never recorded in the user defaults.
This should be handled automatically by the NSEditor and
NSEditorRegistration protocols.
Of course, you can track controlTextDidChange: and update the model
yourself, but that seems like a
lot of work for something I feel should be the standard behavior.
In the 'value' binding, check the box labeled "Continuously update
values".
6) Shouldn't there be an easy way to get a case insensitive sort from
IB. I
realize that you can set up sort descriptors to get
caseInsensitiveCompare:
instead of compare: -- but since views of the filesystem are common, it
would be nice to have some easy way to configure this directly in the
NIB.
In a table view?
In the column's Attributes Inspector, set the key and sort selector.
7) I have yet to find an easy way (e.g. no code) to "reset" a value
which is
bound to another control. It would be VERY nice to have a capability
where
pressing a button would cause a slider to go to a specified value
(think
reset.) Or where some user action filled in a form with preset values.
Or...
Surely all these are possible using either standard target-action or
using target-action-argument bindings on a button? Custom code,
though, is likely to feature somewhere to retrieve any default
values...
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.