-   Programming (
-   -   Any Cocoa experts? (

Prime95 2010-05-22 03:09

Any Cocoa experts?
I have 2 problems that I cannot find an answer to quickly:

1) When I click on a text field and change the value and then click on the "OK" button, the changed value is ignored. The changed text is only registered if I tab out of the field. What have I done wrong?

2) Is there any way to get the Test/Status NSTextField to not highlight misspelled words like "Mersenne", "Lucas", and "Lehmer"?

rogue 2010-05-22 13:28

For the button, does this help? [url][/url]

And for spelling, how about this? [url][/url]

Prime95 2010-05-22 21:07

[QUOTE=rogue;215708]For the button, does this help?[/quote]

Googling that method found the recommended procedure to use (makeFirstResponder). Thanks.

[quote]And for spelling, how about this? [/QUOTE]

I'd seen that before. I think it is a dead end.

At least the more offensive of the two bugs is fixed.

rogue 2010-05-22 22:35

I realized after I posted that NSTextField does not inherit from NSText, thus it probably works differently.

Would NSTextView work better for you than NSTextField? It inherits from NSText.

Something else I see is that NSTextField contains an NSTextView object. You can find that here: [url][/url], which you have probably already seen. In other words, if you access that NSTextView object of the NSTextField class then you should be able to add words to the ignore list as shown in the other link I provided.

Prime95 2010-05-23 00:51

I was hoping to just turn spell checking off rather than assembling a list of words to ignore.

potonono 2010-05-26 00:57

This has a solution for turning it on, so perhaps you can set it to NO to turn it off.


// Focus TextField
[textField becomeFirstResponder];

// Disable Continous Spelling
NSTextView *textView = (NSTextView *)[self.window firstResponder];
[textView setContinuousSpellCheckingEnabled:NO];

All times are UTC. The time now is 15:55.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.