I have a button and an NSTextView in my application. I want NSTextView to get focus when a button is clicked. If I then enter text through the keyboard, it should go into NSTextView.
What code should I enter in the button action method?
Assuming you have an output called textView , this should work:
textView
- (IBAction)buttonClicked:(id)sender { NSButton *button = sender; NSWindow *window = [button window]; [window makeFirstResponder:textView]; }
Source: https://habr.com/ru/post/887705/More articles:The third way to find a duplicate is algorithmIOS: disabled UItextfield - iosFacebook FBConnect fbDialogLogin method on Facebook.m hits EXC_BAD_ACCESS on FBSessionDelegate object _sessionDelegate - iosLinkedin Ruby Gem (Token Rejected in Callback) - ruby | fooobar.comRewriteRule forces page to reload twice - url-rewritingDetermine if this JavaScript action has been triggered by the user - javascriptRace Condition for Persistent Remember Me Cookies - authenticationstatic value in web.config - asp.netDifferences in programming between iPhone and iPad - objective-cHow to unify command line arguments? - pythonAll Articles