SynEdit and SyAutoCorrect

hello,

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

yehiaegAsked:
Who is Participating?
 
Russell LibbySoftware Engineer, Advisory Commented:
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);
begin
  SynAutoCorrect1.Editor:=SynEdit1;
end;

procedure TForm1.SynEdit2Enter(Sender: TObject);
begin
  SynAutoCorrect1.Editor:=SynEdit2;
end;

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

Regards,
Russell

0
 
yehiaegAuthor Commented:
there is was a loop in TSynAutoCorrect.KeyDown that cause StackOverFlow error, i just commented the line and it worked
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.