SynEdit and SyAutoCorrect

Posted on 2005-05-01
Last Modified: 2010-04-05

i'm trying to assign the TSynAutoCorrect.Editor property to my SynEdit at runtime,
the problem is i have more than one SynEdit but i want them all to have the same SynAutoCorrect,
so i thought of something like this:

if (SynEdit1 has focus) then  SynAutocorrect.Editor := SynEdit1
else if (SynEdit2 has Focus ) then SynAutoCorrect.Editor := SynEdit2

but there is always an error StackOverFlow in TSynAutoCorrect.EditorKeyDown
when i change focus between the 2 SynEdit and start typing, if anyone could
imitate what i just did will sure get this error

anyway to slove this?

Thanks In Advance
Yehia A.Salam

Question by:yehiaeg
    LVL 26

    Accepted Solution

    The autocorrect will bind the OnKeyDown and OnMouseDown of the handler, so you need to ensure that the correct editor is set at all times. I tested the following, and found that it worked correctly and without error.

    // Update the editor in the OnEnter event of each editor

    procedure TForm1.SynEdit1Enter(Sender: TObject);

    procedure TForm1.SynEdit2Enter(Sender: TObject);

    If this still causes problem then let me know (and show code, please), and I will assist further



    Author Comment

    there is was a loop in TSynAutoCorrect.KeyDown that cause StackOverFlow error, i just commented the line and it worked

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
    Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now