Page 1 of 1

[Demo] Editing a list of foonotes/endnotes

Posted: Thu Mar 13, 2014 9:19 am
by Sergey Tkachenko

This is a modification of Demos\Delphi\Editors\Notes\ demo

Two new commands are added in the Notes menu:
- Edit List of Foonotes...
- Edit List of Endnotes...

These commands open a dialog window where you can edit all notes in a table.


This example assumes that StyleTemplates are not used. We can create a demo with StyleTemplates on request.

2018-Apr-18: for compatibility with TRichView 17

Posted: Fri Feb 06, 2015 10:48 am
by tothpaul
nice demo that is almost what I need, but is there any way to avoid the cursor to go outside the table ?

let's add some notes, go to the editor, click on a note and start selecting text with Shift+RightArrow; when you reach the end of line the cursor leaves the cell and go to the right of the table :/

Posted: Tue Feb 17, 2015 5:44 pm
by Sergey Tkachenko
Sorry for the delay.
In this demo, you can place the caret before or after the table, but it does not allow typing there (because the table is inserted in a read-only paragraph).

If you do not like it, you can process OnCaretMove, and when the caret is outside the table, move it back. I'll make an example later in this week.

Posted: Wed Mar 11, 2015 8:21 am
by Sergey Tkachenko
How to prevent the caret moving outside the table of notes.

Open NoteListFrm.pas.

1) Add in the interface section, in "uses": CRVData;

2)Add in the interface section:

Code: Select all

2) Add in the declaration of TfrmNoteList:

Code: Select all

    Cell: TRVTableCellData;
    ItemNo, Offs: Integer;
    Moving: Boolean;
    procedure WMBackToTable(var Msg: TMessage); message WM_BACKTOTABLE;
4) Add rveCaretMove handling rve.OnCaretMove.

3) Add in the implementation:

Code: Select all

procedure TfrmNoteList.rveCaretMove(Sender: TObject);
  if not Visible or Moving then
  if (rve.InplaceEditor=nil) and not (rvstCreatingInplace in rve.RVData.State) then begin
    PostMessage(Handle, WM_BACKTOTABLE, 0, 0);
  if rve.InplaceEditor=nil then
  Cell := rve.TopLevelEditor.RVData.GetSourceRVData as TRVTableCellData;
  ItemNo := rve.TopLevelEditor.CurItemNo;
  Offs := rve.TopLevelEditor.OffsetInCurItem;

procedure TfrmNoteList.WMBackToTable(var Msg: TMessage);
var RVData: TCustomRVFormattedData;
  if not Visible or (rve.InplaceEditor<>nil) or (Cell=nil) then
  Moving := True;
    rve.RVData.State := rve.RVData.State - [rvstMakingSelection, rvstLineSelection];
    RVData := Cell.Edit as TCustomRVFormattedData;
    RVData.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);
    Moving := False;

Posted: Thu May 21, 2015 6:13 pm
by Sergey Tkachenko