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: Mon, 31 Dec 2012 10:12:57 -0700
On Dec 30, 2012, at 9:29 PM, Quincey Morris wrote:
> On Dec 30, 2012, at 07:59 , Keary Suska <email@hidden> wrote:
>
>> I am not sure I am experiencing this bug, if I understand you correctly. I can change the binding placeholder string and the bug will show the new changed placeholder string. Changing the text field placeholder string, however, does not appear to have any effect.
>
> If you saw an incorrect placeholder "No selection", I'm saying, then you saw it because Xcode incorrectly put that string the text field Placeholder String at some point in the past. It's got nothing actually to do with a NSController selection, except perhaps in Xcode's fevered imagination.
I think we might be talking past each other a bit but I think it might be useful for posterity that I am seeing a particular erroneous behavior that may or may not be different than what you experienced.
Although any discussion of bindings internals is speculative in nature, I think I can reasonably deduce the following (and this includes further testing that might have changed earlier assumptions):
When the binding is established a call is made to the controller by all the bindings for its value and it is returning "<NO SELECTION MARKER>", which is likely true as the controller hasn't been fully set up yet (it has a content binding). I then see a second call to the controller, which returns the expected value for the binding. All seems well, *except* that at this point the placeholder string should be something else because clearly all the players involved understand that there is a valid selection. Or at least it is not the appropriate placeholder--it should be the null placeholder, as that is what would be appropriate if the field was cleared and committed.
It is then my conclusion that this is a run-time issue, although because it doesn't happen for every bound text field it must be triggered by something Xcode is doing to the xib, whether during creation or compilation.
> However, Xcode doesn't do this routinely. It only happened to me the first time I established a binding for text field newly added to the XIB, then never again. It's presumably dependent on the order of things in the XIB and/or the history of what was changed.
Also I wanted to mention in my previous email simply that no matter how I change the placeholders (both binding and text field), bind-unbind, and even delete and recreate the field, the behavior persists consistently. I would also add that this issue did not seem to happen until I upgraded Xcode to 4.3. As I mentioned, these xibs are old (most were nibs at one point) and the behavior has only recently surfaced.
>> Looks like I am back to setting the binding placeholder for every field <sigh>
>
> AFAIK you always had to do this. The binding placeholder fields in IB are by default *empty* (though in some cases they *display* gray IB placeholder text to indicate what you would put there if you chose to use the fields), so you would have had to go through once entering binding placeholder strings.
It used to show them, but for some reason it seems like they stopped in 4.x. Or do you seem them even in 4.x?
> Because of the [apparent] field editor bug, you'd be faced with also setting the text field Placeholder string for every field as well. So, yes, to work around the problem this way, you do have to edit every field.
Yes, although I need to set the placeholder in the binding, to be clear, as the text field placeholder proper is overwritten when the binding is used.
> I wonder, though, what happens if you set the placeholder string directly, after the NIB has loaded. It's a property of the text field cell. Maybe you'd need to set it on the text field cell, or maybe you'd need to set it on the field editor cell.
I tested this and it will show the placeholder I set (it is a property of the cell). The placeholder is then apparently re-set after editing is committed.
TIA,
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