Page 1 of 1
OnCheckpointVisible in TRichViewEdit?
Posted: Wed Apr 16, 2008 10:04 pm
by ianh
Hello
Are there any plans to include the event OnCheckpointVisible within the TRichViewEdit component?
Thanks
Ian
Posted: Thu Apr 17, 2008 8:32 am
by Sergey Tkachenko
No, not in near future.
You can try to implement it yourself - in OnVScrolled and OnChange events, check items starting from FirstItemVisible, using GetItemCheckpoint.
Posted: Thu Apr 17, 2008 9:33 am
by ianh
> You can try to implement it yourself .....
OK cool. I didn't want to start doing it if there was a fundamental problem that I hadn't spotted, or if it was going to be included in the near future anyway.
Thanks.
Posted: Thu Apr 17, 2008 12:56 pm
by Sergey Tkachenko
Actually, it's not very difficult. It was not implemented only because in TRichView checkpoint may appear only as a result of scrolling or resizing (and resizing usually causes scrolling), but in TRichViewEdit it may also appear as a result of editing. So the code used in TRichView will not always work in editor. This TRichView code is more optimal than I suggested in my reply (cycle from FirstItemVisible with GetItemCheckpoint), but more complicated.
Adding this single cycle in event is very simple, but it may slow down editing, especially if you want to implement CPEventKind=cpeAsSectionStart, and document is large and have a small count of checkpoints.