display problem in AfterCompleteWordEvent

  • Hello,

    Very new to WpTools (version 5.36) I am trying to implement an autocomplete mechanism. Looking through the forum I found several topicxs suggesting to use the AfterCompleteWordEvent. in this way:


    Code
    if lastchar <> #32 then exit;
      s := Document.cpWord;
      if (CompareText(s, 'nocom')=0) then
      begin
        Document.cpWord := 'We have no further comments in this respect. ';
       end;

    If I test on the 1st line of a document then it is fine, if I do this on any other line then only the last few characters appear until I press 'enter'

    I have tried to apply a repaint to the wpRichText object but had no luck

    Any ideas ?

    Didier