0

I have 2 RichEdits with the same content, but with different width and height. When I select a certain word in one RichEdit, I want to see the same word selected in another one. Using SelStart / SelLength doesn't select the exact same word (most likely because of different client width/height of the controls).

How would you do this?

Max Smith
  • 395
  • 1
  • 2
  • 13
  • `.SelStart` and `.SelLength` both operate character wise - how would different widths and heights have any influence on this? What have you achieved so far? Using `OnSelectionChange` seems obvious... – AmigoJack Jul 13 '20 at 14:30
  • 1
    @AmigoJack: SelStart and SelLength take line breaks into account. This includes those induced from word wrapping. – Uwe Raabe Jul 13 '20 at 16:14
  • `.WordWrap` was nowhere mentioned - any other details that remain untold? Also cannot reproduce with D7: selecting text after a `.WordWrap:= TRUE` broken line gives me the same values as with `.WordWrap:= FALSE` at the same position/length. – AmigoJack Jul 13 '20 at 17:08
  • @AmigoJack, I made a test with FindText in Delphi 10.3.3 those values differ by the difference of line breaks before that word. May be because D7 uses RICHEDIT from RICHED32.dll and Rio uses RICHEDIT20 from RICHED20.dll. – Uwe Raabe Jul 13 '20 at 19:42
  • @UweRaabe my 32bit process loaded both: RICHED32.dll (6.1.7601.17514) and RICHED20.dll (5.31.23.1230) from SysWOW64 on Win7x64 - so much for different behaviour/experiences when details are omitted. Likewise OP never stated his (target) environment. – AmigoJack Jul 14 '20 at 08:59

0 Answers0