today's AppKit gymnastics:
as i discovered yesterday, removing the border or bezel of the NSSearchField leads to the search text covering the cancel/clear button.
so, i dutifully hid the internal button, created my own and positioned it correctly. fine.
but telling the searchField that it's new value an empty string (even with KVO or using the built-in stringValue method) superficially works -- but leads to inconsistent values between the controllers and views. yuck.
why, you ask?
1/…
=> More informations about this toot | More toots from isaiah@mastodon.social
if you programatically change the text in an NSSearchField, the search field will bafflingly not update the stringValue binding.
i don't know why, it seems like it would actually take work to do.
after hunting around i could not find any way to nudge it into updating things.
but the search field relies on an NSTextView field editor, and I know how to kick that into gear and it works. yeah!
just call the textDidChange: method manually it will trigger the binding to do the expected stuff.
2/…
=> More informations about this toot | More toots from isaiah@mastodon.social
the textDidChange: needs be called with the notification from the NSTextView's NSText object
the notification should have the text did change notification name, the field editor object, and according to the docs, no userInfo dict.
in practice however, the NSText object always adds itself to the userInfo dictionary with the key "NSFieldEdiotr" -- furthermore leaving out this value will lead to an unknown selector exception.
3/3
=> More informations about this toot | More toots from isaiah@mastodon.social
one last thing…
if you happen to know about AppKit and NSSearchField or why NSTextField's don't update their bindings please let me know.
i would love love LOVE to delete this hack and eliminate the NSSearchField subclass from this little Open Quickly UI.
i have zero qualms about eating crow here and finding out i'm doing everything wrong.
=> More informations about this toot | More toots from isaiah@mastodon.social This content has been proxied by September (ba2dc).Proxy Information
text/gemini