Bonjour à tous,

https://docwiki.embarcadero.com/Libr....SpellChecking

Es t’il possible d'afficher toute les fautes orthographe du TRichEdit.

Le problème est que lorsque l'option SpellChecking est activée, elle ne met pas à jour automatiquement le RichEdit, il n'affiche donc pas toute les fautes orthographe.

En revanche, il se déclenche bien lors de la saisie de texte.

Nom : Capture.PNG
Affichages : 387
Taille : 17,4 Ko

Cela fonctionne aussi lors d'un Ctrl+C & Ctrl+V, il affiche toute les fautes orthographe.

J'ai testé la méthode Repaint() en vain sans succès.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
procedure TForm1.CkSpellCheckingClick(Sender: TObject);
begin
  if CkSpellChecking.Checked then
    RichEdit.SpellChecking := True
  else
    RichEdit.SpellChecking := False;
 
  RichEdit.Repaint;
end;
J'ai cherché dans l'unité Vcl.ComCtrls ou ce trouve la (property SpellChecking) qui elle renvoi vers cette procédure :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
procedure TCustomRichEdit.SetSpellChecking(Value: Boolean);
begin
  if FSpellChecking <> Value then
  begin
    FSpellChecking := Value;
    if FSpellChecking then
      DoEnableSpellChecking
    else
      RecreateWnd;
  end;
end;
 
procedure TCustomRichEdit.DoEnableSpellChecking;
begin
  if HandleAllocated then
  begin
    // Ref: https://docs.microsoft.com/en-us/archive/blogs/murrays/richedit-spell-checking-autocorrection-and-prediction
    SendMessage(Handle, EM_SETLANGOPTIONS, 0, IMF_SPELLCHECKING);
    SendMessage(Handle, EM_SETEDITSTYLE,
      SES_USECTF or SES_CTFALLOWEMBED or SES_CTFALLOWSMARTTAG or SES_CTFALLOWPROOFING,
      SES_USECTF or SES_CTFALLOWEMBED or SES_CTFALLOWSMARTTAG or SES_CTFALLOWPROOFING);
  end;
end;
Cette procédure permet activé le SpellChecking du TRichEdit.

Mes impossible de mettre à jour le TRichEdit.

Auriez vous un idée ?

Merci