TRVStyle.OnDrawCheckpoint

<< Click to display table of contents >>

TRVStyle.OnDrawCheckpoint

Occurs when drawing checkpoint.

property OnDrawCheckpoint: TRVDrawCheckpointEvent;

VCL and LCL:

type

  TRVDrawCheckpointEvent =

    procedure (Sender: TRVStyle; Canvas: TCanvas;

      X,Y: TRVCoord; ItemNo: Integer; XShift: TRVCoord;

      RaiseEvent: Boolean; Control: TControl;

      var DoDefault: Boolean) of object;

(introduced in version 1.3)

FireMonkey:

type

  TRVDrawCheckpointEvent =

    procedure (Sender: TRVStyle; Canvas: TRVFMXCanvas;

      X,Y: TRVCoord; ItemNo: Integer; XShift: TRVCoord;

      RaiseEvent: Boolean; Control: TControl;

      var DoDefault: Boolean) of object;

You can use this event to draw your own visual representation of checkpoints.

This event occurs only if rvoShowCheckpoints is included in TCustomRichView(Control).Options.

Input parameters:

Sender – TRVStyle generating the event.

Canvas – canvas to paint.

X,Y – coordinates of the top left corner of the item marked with this checkpoint. If this is the last checkpoint in document (that is not associated with any item), X = -1.

ItemNo – index of this item in Sender.RVData. (ItemNo = -1 for checkpoint without item).

XShift – how much TRichView is scrolled horizontally (>=0);

RaiseEvent – "raise event" flag of the checkpoint.

Control – TRichView control.

DoDefault is equal to True.

 

"Hidden" input parameter:

Sender.RVData: TPersistent, document containing the item with this checkpoint. It should be typecasted to TCustomRVFormattedData before using.

 

Output parameters:

DoDefault – set to False to prevent default drawing. The default procedure draws horizontal dotted line with small circle in (X,Y). The line color is either CheckpointColor or CheckpointEvColor, depending on RaiseEvent.

 

Using ItemNo and Sender.RVData you can get additional information about the item and the checkpoint.

For example:

uses ..., CRVFData;

...

var

  CheckpointData: TCheckpointData;

  CheckpointTag: TRVTag;

  CheckpointName: String;

begin

  if ItemNo>=0 then

  begin

    CheckpointData :=

      TCustomRVFormattedData(Sender.RVData).GetItemCheckpoint(

        ItemNo));

    TCustomRVFormattedData(Sender.RVData).GetCheckpointInfo(

      CheckpointTag, CheckpointName, RaiseEvent);

    ...

  end;

end

See also properties:

CheckpointColor, CheckpointEvColor.

See also:

Checkpoints overview.

Demo project:

Demos\*\Assorted\Custom Draw\CustomDraw\