Re: Bound NSTextField displays Selection Placeholder instead of Null Placeholder
Re: Bound NSTextField displays Selection Placeholder instead of Null Placeholder
- Subject: Re: Bound NSTextField displays Selection Placeholder instead of Null Placeholder
- From: Keary Suska <email@hidden>
- Date: Sat, 29 Dec 2012 08:22:16 -0700
On Dec 28, 2012, at 10:37 PM, Quincey Morris wrote:
> On Dec 28, 2012, at 20:53, Keary Suska <email@hidden> wrote:
>
>> in my case it only happens when the there is a value before the window is shown, but then cleared, but not exited.
>
> Just to clarify, are you saying that when you delete the field's contents it displays the No Selection marker, and then if you press Return it immediately displays the Nil marker?
Yes, but only if the bound value is initially non-nil and non-empty (@"""). Additionally, under these circumstances, when no placeholder value is specified the field will show "no selection" but for nil values simply display blank. This might be default behavior but I forget...
>> So, the value isn't even being changed in the model and I have verified that the controller isn't even queried about the model value's state. Therefore, the controller is *not* returning the no selection marker, but somehow the field editor is getting confused.
>
> What happens if you tab out of the text field, while it's still empty, then tab back into it? If it does the right thing this time, that might suggest that the field editor is being configured too early, before the array controller has in fact initialized its selection.
Same behavior. And to be clear, the controller is an NSObjectController subclass.
> What does it display initially if you simply unbind the text field?
The correct, expected behavior. To be specific, I unbind the field but call -setStringValue: on -awakeFromNib to mimic the requirement of an initial value.
> Bind it to a property that's nil?
Well, in all cases if the initial value is nil or empty the placeholder behavior is correct and expected. I did test this explicitly, BTW, to be sure.
I have also:
* "detached" the custom formatter to make sure it wasn't involved and it doesn't appear to be (same behavior whether formatter is involved or not).
* replaced the model object with a vanilla NSMutableDictionary--no help.
* replaced the controller with a vanilla NSObjectController (specifically, simply removed the custom class specification from the xib)--no help
One thing I haven't done yet is to re-create the xib entirely. I did create a new xib then copied and pasted, but that may have copied something over that shouldn't.
I should note that most of the xibs were initially nibs dating back to Xcode 2.x
Anything else you can think of? Your help is greatly appreciated.
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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