Unplanned
Last Updated: 18 Nov 2022 13:29 by ADMIN
Kipp
Created on: 03 Nov 2022 09:08
Category: SpellChecker
Type: Feature Request
2
RadSpellChecker: Long delay when typing for the first time in the AutoSpellCheckControl

Add a RadSpellchecker and a RadTextBox:

        public RadForm1()
        {
            InitializeComponent();

            this.radSpellChecker1.AutoSpellCheckControl = this.radTextBox1; 
        }

When running the application and typing fast "th", you will notice that there is a slight delay before seeing "h" in the editor.

However, the next time you type "th", it will be entered instantly.

All the dictionaries for the spell checking functionality are loaded with MEF. That is why the initial loading may be slow. RadRichTextEditor uses internally Telerik.WinForms.Documents.Proofing.DocumentSpellChecker which offers AutomaticallyLoadDefaultDictionaries property. It controls whether MEF should be used to load default dictionaries. Such functionality should be introduced for Telerik.WinControls.SpellChecker.Proofing.DocumentSpellChecker used by RadSpellchecker.

Note: Please refer to Example 8: Use Spell Checking Without MEFhttps://docs.telerik.com/devtools/wpf/controls/radrichtextbox/mef 

5 comments
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 18 Nov 2022 13:29

Hello, Doug,

I am glad that the suggested solution works for your scenario. Make sure that you follow the item in order to get notified once any status changes occur.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Doug
Posted on: 17 Nov 2022 15:44

To all future people interested in this:

The solution provided by Dess works great! Click through the links for a more complete understanding of what you are doing. (and use the suggestion to add the dictionary as a project resource rather than a raw file).

I modified it a bit to work in my use case. (6 controls using it).

Create the dictionary once, use it for all controls.

Thank you Dess!

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 17 Nov 2022 14:40

Hello, Doug,

The following code snippet shows how to force loading the dictionary with the tdf file:

        public Form1()
        {
            InitializeComponent();

            radSpellChecker1.AutoSpellCheckControl = radChat1.ChatElement.InputTextBox.TextBoxItem;
            Stopwatch sw = new Stopwatch();
            sw.Start();
            IControlSpellChecker textBoxControlSpellChecker = this.radSpellChecker1.GetControlSpellChecker(typeof(RadTextBox));
            DocumentSpellChecker documentSpellChecker = textBoxControlSpellChecker.SpellChecker as DocumentSpellChecker;
            documentSpellChecker.SpellCheckingCulture = EnglishCulture;
            documentSpellChecker.AddDictionary(new MyDictionary(true), EnglishCulture);
            sw.Stop();
            this.Text = sw.ElapsedMilliseconds.ToString();
        }

        private static readonly CultureInfo EnglishCulture = CultureInfo.GetCultureInfo("en-US");
        public class MyDictionary : WordDictionary
        { 

            public MyDictionary(bool forceLoading)
            {
                if (forceLoading)
                {
                    this.EnsureDictionaryLoaded();
                }
            }

            protected override void EnsureDictionaryLoadedOverride()
            {
                using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(@"..\..\en-US.tdf")))
                {
                    this.Load(ms);
                }
            }
        }

 If a dictionary with this culture already exists, it is overwritten. I hope this will be helpful for your scenario.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Doug
Posted on: 17 Nov 2022 14:20

Is there a workaround for this to preload the dictionaries manually?

Excellent feature, but the delay is very noticeable.

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 03 Nov 2022 09:33

Hello, Kipp,

Thank you for bringing this to our attention. We will do our best to improve the performance or RadSpellchecker when loading the dictionaries.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.