osx - Spelling suggestions in NSTextField -


my app has nstextfields input; purposely not use nsnumberformatter in order special handling of input. app implements "full screen" mode. when app in full screen, , focus in text field, , press esc key resume windowed mode, instead pop-up spelling suggestions/completions. don't want either of these behaviors when esc key pressed: completions pop-up, nor not being able exit full screen mode. suggestions? thanks.

you need setup nstextfielddelegate handle command, , set delegate on textfield. here's example:

@property (weak) iboutlet nswindow *window; @property (weak) iboutlet nstextfield *textfield; @end  @implementation appdelegate  - (void)applicationdidfinishlaunching:(nsnotification *)anotification {     // insert code here initialize application     self.textfield.delegate = self; }  - (bool)control:(nscontrol*)control textview:(nstextview*)textview docommandbyselector:(sel)commandselector {     if (commandselector == @selector(canceloperation:)) {         nslog(@"handlecancel");         return yes;     }     return no; } 

```

if wanted eliminate spelling suggestions, override following method, above both.

- (nsarray *)control:(nscontrol *)control textview:(nstextview *)textview completions:(nsarray *)words forpartialwordrange:(nsrange)charrange indexofselecteditem:(nsinteger *)index { return nil; } 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -