Bonjour,

Afin de repérer les mots mal orthographiés dans TRichEdit Spellchecking lorsqu'une sélection est effectué, je voudrais vérifier si la sélection comporte une ligne ondulée.

J'utilise CHARFORMAT2A pour récupéré la valeur du type bUnderlineType

Nom : Capture.PNG
Affichages : 405
Taille : 42,7 Ko

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
{ MisspelledWord }
procedure MisspelledWord(RichEdit: TRichEdit);
const
  CFU_UNDERLINEWAVE = 8; { Ligne ondulée }
var
  Format2A: CHARFORMAT2A;
begin
  FillChar(Format2A, SizeOf(Format2A), 0);
 
  with Format2A do
  begin
    cbSize := SizeOf(Format2A);
    RichEdit.Perform(EM_GETCHARFORMAT, SCF_SELECTION, LPARAM(@Format2A));
 
    Form1.Caption := 'bUnderlineType = ' + IntToStr(bUnderlineType);
 
    if bUnderlineType = CFU_UNDERLINEWAVE then
      ShowMessage('Mot mal orthographié !');
  end;
end;
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
procedure TForm1.RichEditMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState;
  X, Y: Integer);
begin
  MisspelledWord(RichEdit);
end;
Le hic, c'est que je ne parviens pas à récupérer la valeur du type bUnderlineType, Cela me renvoie toujours la valeur 1.

Auriez-vous une petite idée ? Merci