I cant seem to get the AdvMemo1.ClearLineErrors & AdvMemo1.ClearWordError procedures to remove the line errors {red squiggle underline} from the AdvMemo1.SetError procedure.
here is my example:
type
TForm1 = class(TForm)
AdvMemo1: TAdvMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
procedure TForm1.Button1Click(Sender: TObject); //showErrAll btn
Var i: Integer;
begin
For i := 0 To AdvMemo1.Lines.Count -1 Do
AdvMemo1.SetError(i, 0{ErrStartPos}, Length(AdvMemo1.Lines.Strings){ErrLen});
end;
procedure TForm1.Button2Click(Sender: TObject); //remove Err Line 1
begin
AdvMemo1.ClearLineErrors(0);
AdvMemo1.ClearLineErrors(1);
AdvMemo1.ClearLineErrors(999);
end;
procedure TForm1.Button3Click(Sender: TObject); //remove Err Line 1 word 1
begin
AdvMemo1.ClearWordError(1{line#}, 0 {linepos});
AdvMemo1.ClearWordError(1{line#}, 1 {linepos});
AdvMemo1.ClearWordError(1{line#}, 99 {linepos});
AdvMemo1.ClearWordError(2{line#}, 0 {linepos});
AdvMemo1.ClearWordError(2{line#}, 1 {linepos});
AdvMemo1.ClearWordError(2{line#}, 99 {linepos});
end;
After calling ClearLineErrors(), call AdvMemo.Invalidate;
Thanks that worked for AdvMemo1.ClearLineErrors but AdvMemo1.ClearWordError still does not seem to repaint
I have retested this here but
Thank you for your kind response. maybe I'm not sure what the procedure AdvMemo1.ClearWordError is suppose to do. The calls
"AdvMemo1.ClearWordError(0, 0); AdvMemo1.Invalidate;" or
"AdvMemo1.ClearWordError(1, 0)AdvMemo1.Invalidate;"
appear to do the exact same thing as a call to
"AdvMemo1.ClearLineErrors(0);" or
"AdvMemo1.ClearLineErrors(1);"
That is remove the red underline for the entire line. is there a call that just removes the red underline for a specific word in the line?
I'm using the following text in the memo lines;
procedure TForm1.FormCreate(Sender: TObject);
begin
AdvMemo1.Clear;
AdvMemo1.Lines.Add('line1word1 line1word2');
AdvMemo1.Lines.Add('line2word1 line2word2 line2word3');
AdvMemo1.Lines.Add('line3word1 line3word2 line3word3 line3word4');
AdvMemo1.Lines.Add('word1 word2, word3 word4');
end;
AdvMemo1.ClearWordError(0, 0); //red underline is remove for entire line
AdvMemo1.ClearWordError(1, 1); //red underline remain for entire line
AdvMemo1.ClearWordError(2, 2); //red underline remain for entire line
AdvMemo1.ClearWordError(3, 3); //red underline remain for entire line
AdvMemo1.Invalidate;
ClearLineErrors deletes all error markers on a specific line.
ClearWordError clears only the error on a line that starts at a specific position. So, if there is an error marker for a word that starts on text x-position A at line L, you'd remove it with ClearLineError(L,A);
Got it. thanks for your help