Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

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

0
yehiaeg
Asked:
yehiaeg
1 Solution
 
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

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now