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: Sun, 30 Dec 2012 08:59:18 -0700
On Dec 29, 2012, at 3:16 PM, Quincey Morris wrote:
> Well, I have part of the answer. I think there are 2 bugs, though it's not entirely clear.
>
> AFAICT, the reason it's showing the No Selection placeholder is roundabout. It *isn't* displaying the No Selection placeholder as a result of the binding. It's actually displaying the Placeholder String of the *text field* (when you delete the contents after there's initially been something there), but when you originally created the binding Xcode changed the Placeholder String in the text field to the No Selection string from the binding. At least, that's what happened to me.
>
> This appears to be a bug in Xcode, and it only happened when I first established the binding. After that, playing with the binding placeholders didn't have any effect on the text field Placeholder String. (However, Xcode did crash dramatically one time, right after I changed a binding placeholder and tried to select the text field. That seems relevant.)
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.
> The second bug (I think) is that the field editor displays the text field Placeholder String at first (i.e. when you delete the contents after there's initially been something there), but the appropriate binding placeholder at other times. I still suspect this is a timing issue with NIB loading, where the text field caches the placeholder it's going to tell the field editor to use before it's seen that there's going to be a binding that supplies a different placeholder.
>
> The workaround for the first bug (which would make the second bug moot) is to change the text field Placeholder String to match the binding's Null placeholder. Of course, that means you'll still have to go in and edit (or at least check) each text field in Xcode.
>
> I dunno about a workaround for the second bug (which would make the first one moot, I suppose). Perhaps if your could arrange to re-set the text field to its initial value after the window has been displayed, the field editor problem would go away. Or perhaps you'd have to to set it to the empty string or nil, before you re-set it to the correct thing. Or perhaps you'd have to re-set it before the field editor is created.
This seems to be the issue. Watching NSTextFieldCell shows that when the xib is first loaded the cell's placeholder string is set to the "no selection" placeholder, which certainly might be the case depending on when the binding is established and queried, but never updated when the controller's state changes until after the editor has committed edited.
Curiously, even if I change to where the controller content is set well after nib loading, the same behavior occurs, so I am inclined to think my problem is a timing issue with nib loading, but the fact that the appropriate placeholder is never updated until the first edit.
Looks like I am back to setting the binding placeholder for every field <sigh>
Thanks for all your help!
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