Recent

Author Topic: TMemo caret position in Delphi and Lazarus  (Read 949 times)

backprop

  • Full Member
  • ***
  • Posts: 101
TMemo caret position in Delphi and Lazarus
« on: July 21, 2024, 12:27:22 pm »
https://docwiki.embarcadero.com/Libraries/Athens/en/FMX.Memo.TCustomMemo.CaretPosition

I have notice here Lazarus reinventing wheel with CaretPos.

Why? You simply breaking compatibility.
« Last Edit: July 21, 2024, 12:35:21 pm by backprop »

ASerge

  • Hero Member
  • *****
  • Posts: 2337
Re: TMemo caret position in Delphi and Lazarus
« Reply #1 on: July 21, 2024, 03:23:54 pm »
https://docwiki.embarcadero.com/Libraries/Athens/en/FMX.Memo.TCustomMemo.CaretPosition

I have notice here Lazarus reinventing wheel with CaretPos.

Why? You simply breaking compatibility.
It is FMX in Delphi breaks compatibility. CaretPos.

jamie

  • Hero Member
  • *****
  • Posts: 6735
Re: TMemo caret position in Delphi and Lazarus
« Reply #2 on: July 21, 2024, 03:57:53 pm »
Windows Memo does not track the cursor position to the actual line on the screen unless all lines have not wrapped around.

A wrapped line will report the next line as being one less than it appears on the screen.

 what windows does do however, is it searches the list looking for Line Endings and uses that as the indicators so if you are depending on the Cursor to be in alignment with the screen and actual lines in text, don't bank on it.

 In other targets this may not be case but in windows a whole set of memo messages are designed to track the cursor internally.

  Additional note to this, it is a Memo and normally memos are short little text, not monster editors and therefor using $MS method of tracking the lines could become slower than you would expect.


The only true wisdom is knowing you know nothing

ASerge

  • Hero Member
  • *****
  • Posts: 2337
Re: TMemo caret position in Delphi and Lazarus
« Reply #3 on: July 22, 2024, 04:24:50 pm »
Windows Memo does not track the cursor position to the actual line on the screen unless all lines have not wrapped around.
In fact, Windows memo TRACKS the visual position of the cursor on the screen. For example, if one long line (without linefeed) is split into three by wordwrap, then in the last position CaretPos.Y = 2.

 

TinyPortal © 2005-2018