Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Highlight in AdvRichEditor

 Post Reply Post Reply
Author
Neumann Thoralf View Drop Down
New Member
New Member
Avatar

Joined: 12 Feb 2015
Posts: 2
Post Options Post Options   Quote Neumann Thoralf Quote  Post ReplyReply Direct Link To This Post Topic: Highlight in AdvRichEditor
    Posted: 12 Nov 2019 at 11:57am
Hello, I want to highlicht some words in AdvRichEditor. The word are in a StringList.
After every Change of the Editor Content, it should update the highlight.

My Code so far in the procedure RichEditorChange:
 var ASel : integer := ARichEditor.SelStart;
 ARichEditor.OnChange := nil;
 ARichEditor.UnHighlight;

 for var AIndex: integer := 0 to Pred(AStringList.Count) do
 begin
    if ARichEditor.FindFirst(Format('?%s?', [AStringList[AIndex]])) then
    begin
      ARichEditor.SetSelectionHighlight;
      while ARichEditor.FindNext do
        ARichEditor.SetSelectionHighlight;
    end;
  end;
  ARichEditor.ClearSelection;
  ARichEditor.SetCaret(ASel); 
  ARichEditor.CaretToSelection;

  ARichEditor.OnChange := RichEditorChange;

it is working, but for example TAB and Enter isn't working correctly anymore. What is wrong?
Best regards


Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8326
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 12 Nov 2019 at 6:18pm
I retested this here but I couldn't see an issue with tab & enter?
What *exact* issue do you experience?
After highlighting i can just tab & enter in the TAdvRichEditor as expected.
Back to Top
Neumann Thoralf View Drop Down
New Member
New Member
Avatar

Joined: 12 Feb 2015
Posts: 2
Post Options Post Options   Quote Neumann Thoralf Quote  Post ReplyReply Direct Link To This Post Posted: 12 Nov 2019 at 9:59pm
Did you set the Highlight methode to the RichEdit Change Event?

procedure TTest.RichEditor1Change(Sender: TObject);
begin
  inherited;
  HighlightPlaceholder(RichEditor1);
end;

So when I press enter and then type any letters, they are inserted to the first position of the line, not to the end, because the caret isn't jumping to the next position.

when I insert a TAB and I want to remove it then, it isn't working, like the key is discarded inernally.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down