View Issue Details

IDProjectCategoryView StatusLast Update
0014635Lazarus CCR-public2020-01-14 04:51
ReporterDominique Louis Assigned ToDmitry Boyarintsev  
Status resolvedResolutionwon't fix 
Summary0014635: TRichMemo - CaretPos property not returning correct X & Y position...
DescriptionIf I access a TRichMemo's CaretPos property, initially it seems fine, but if I load and RTF file via
fs := TFileStream.Create(Utf8ToAnsi(odRTF.FileName), fmOpenRead or fmShareDenyNone);

Then access rmEditor.CaretPos.X or Y, the value is wrong.

Please refer to the attached unit1 replacement for the TRichMemo example.

Unzip the contents of into your demo directory, it should only replace unit1.* . Compile the project1.lpr and load an RTF file. You should see that the X and Y position returned from CaretPos are not consistent with the end of the loaded RTF file.
TagsNo tags attached.
Attached Files


2009-09-19 17:26 (73,478 bytes)

Dominique Louis

2009-09-19 17:27

reporter   ~0030837

I forgot to add that the demo is not 100% finished yet, but hopefully it is enough to see the CaretPos error.

Dmitry Boyarintsev

2009-09-19 22:24

developer   ~0030842

it's not a bug.

CaretPos on KeyDown event, is still old, because the event is not yet processed by the widget. (Caret moving might not even happen, if Key code is changed to 0)

CaretPos is updated on KeyUp event.

The following code works identical on both Win32 and Carbon systems, for RichMemo and Memo:

procedure TForm1.Memo1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
  with Memo1.CaretPos do
    Caption := Caption + Format(' - up: %d %d', [X, Y]);

procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  with Memo1.CaretPos do
    Caption := Format('down: %d %d', [X, Y]);

Dmitry Boyarintsev

2009-09-19 22:25

developer   ~0030843

btw, please attach .lpi and .lpr files to the demo.

thanks. The demo looks promising!

Dmitry Boyarintsev

2009-09-20 06:59

developer   ~0030845

please attach the .rtf file

2009-09-20 11:45


Week 7.rtf (716 bytes)

Dominique Louis

2009-09-20 11:45

reporter   ~0030856

RTF Attached.

Dominique Louis

2009-09-22 20:42

reporter   ~0030919

Any joy?

Dmitry Boyarintsev

2020-01-14 04:51

developer   ~0120422

carbon is dead

Issue History

Date Modified Username Field Change
2009-09-19 17:26 Dominique Louis New Issue
2009-09-19 17:26 Dominique Louis File Added:
2009-09-19 17:26 Dominique Louis Widgetset => Carbon
2009-09-19 17:27 Dominique Louis Note Added: 0030837
2009-09-19 18:21 Dmitry Boyarintsev Status new => assigned
2009-09-19 18:21 Dmitry Boyarintsev Assigned To => Dmitry Boyarintsev
2009-09-19 22:24 Dmitry Boyarintsev Note Added: 0030842
2009-09-19 22:25 Dmitry Boyarintsev Note Added: 0030843
2009-09-19 22:26 Dmitry Boyarintsev Status assigned => resolved
2009-09-19 22:26 Dmitry Boyarintsev Resolution open => no change required
2009-09-20 06:59 Dmitry Boyarintsev Status resolved => feedback
2009-09-20 06:59 Dmitry Boyarintsev Resolution no change required => reopened
2009-09-20 06:59 Dmitry Boyarintsev Note Added: 0030845
2009-09-20 11:45 Dominique Louis File Added: Week 7.rtf
2009-09-20 11:45 Dominique Louis Note Added: 0030856
2009-09-22 20:42 Dominique Louis Note Added: 0030919
2010-03-11 23:11 Vincent Snijders Status feedback => assigned
2020-01-14 04:51 Dmitry Boyarintsev Status assigned => resolved
2020-01-14 04:51 Dmitry Boyarintsev Resolution reopened => won't fix
2020-01-14 04:51 Dmitry Boyarintsev Widgetset Carbon => Carbon
2020-01-14 04:51 Dmitry Boyarintsev Note Added: 0120422