1 Reply
      Latest reply on May 22, 2019 5:57 AM by digitalheaven
      digitalheaven Level 1 Level 1 (0 points)

        I'm very confused by how these menus are designed to work with an NSTextView. I can't find any docs on the subject.

         

        I'm specifically talking about the "Check Spelling While Typing" and "Correct Spelling Automatically" menus.

         

        Some puzzles:

        1. On app launch, "Spelling and Grammar > Correct Spelling Automatically" seems to take its value from System Preferences > Keyboard > Text > Correct Spelling Automatically. But changing it in the menu does NOT update the value in System Preferences.
        2. These settings seem to be unique to each NSTextView, which is odd, rather than being across all NSTextViews in the app. So due to 1. this is a problem because the options get reset when the user moves to another NSTextView! Not a great user experience.
        • Re: How are the Edit > Spelling and Grammar menus supposed to work?
          digitalheaven Level 1 Level 1 (0 points)

          There's little documentation on this, so after using a support request I now know:

           

          1. This is as-designed. If you do not specifically set the value of automaticSpellingCorrectionEnabled, on an NSTextView then the value for NSAutomaticSpellingCorrectionEnabled in global domain (i.e. System Preferences) is used. However this is a read-only process and changing the menu state in your app will not update the global value, so it needs to be stored locally. Note there is no global preference for "Check Spelling While Typing" (continuousSpellCheckingEnabled) and this is assumed to be NO by default.
          2. This is also as-designed. It's up to the developer to set the values on each NSTextView as required.

           

          It is necessary to override:

          - (void)toggleAutomaticSpellingCorrection:(id)sender

          - (void)toggleContinuousSpellChecking:(id)sender

           

          in the NSTextView subclass to handle the user's interactions with these menus and save the new values as needed. Remember to call super at the end!