Sign in Join
FPDoc Onlineexperiment

CompareCaret function

In unit LazUtilities

Gets the relative order for the specified caret positions based on the X and Y positions.

Declaration

pascal
function CompareCaret(Caret1: TPoint; Caret2: TPoint): Integer

Arguments

Caret1

TPoint instance with a caret position compared in the routine.

Caret2

TPoint instance with a caret position compared in the routine.

Function result

Relative order for the caret positions. -1, 0, or 1.

Description

CompareCaret is an Integer function used to determine the relative order for the specified caret positions.

Caret1 and Caret2 are TPoint instances where the X and Y members represent the coordinates for a caret position. CompareCaret examines the X and Y members to determine the return value for the function. For example:

-1
Y member in Caret1 is larger than the member in Caret2. Or, X member in Caret1 is larger than the member in Caret2.
1
Y member in Caret1 is smaller than the member in Caret2. Or, X member in Caret1 is smaller than the member in Caret2.
0
Caret1 and Caret2 have the same values in their respective X and Y members.

CompareCaret is used in the implementation of the TCustomSynEdit / TSynEdit control.

Added in LCL version 4.3.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.