I am building a macOS app with multiple text fields. While a user is editing the first text field, I want all the other text fields to autopopulate (according to the int value of the first text field).
So far, I can auto-populate the fields when the user presses the return key, but I want to auto-populate just by the user typing numbers alone (without pressing any return keys or tab keys etc.).
func control(_ control: NSControl, textView: NSTextView, doCommandBy commandSelector: Selector) -> Bool {
if (commandSelector == #selector(NSResponder.insertNewline(_:))) {
print("User pressed return key")
autoPopulateAllFieldsForInsertedKey()
return true
}
return false
}
I am a beginner in macOS so I would appreciate simple/specific advice. Thanks in advance.