Ancestors

Written by isaiah on 2025-01-21 at 20:34

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

Written by isaiah on 2025-01-21 at 20:39

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

Written by isaiah on 2025-01-21 at 20:40

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

Toot

Written by isaiah on 2025-01-21 at 21:03

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

Descendants

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113868367068347429
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
258.055176 milliseconds
Gemini-to-HTML Time
0.872459 milliseconds

This content has been proxied by September (ba2dc).