MoveVisualCaret

Forms, interaction, Unicode

Description

Moves the active edit caret by one physical visual slot through left-to-right, right-to-left or mixed-direction text

A move without selection extension collapses a selected range to its physical left or right endpoint before any later move continues from that visual slot

Selection extension keeps the logical anchor fixed and moves only the caret, while split caret positions at bidirectional boundaries retain their distinct visual slot

DispatchInputEvent delegates Left and Right keys to this method, while Home, End, Up and Down retain their line-navigation semantics

Declaration

function MoveVisualCaret(ToRight: Boolean;
  ExtendSelection: Boolean = False): Integer;

Parameters

ToRightTrue moves towards the physical right edge and False moves towards the physical left edge
ExtendSelectionTrue preserves the selection anchor and extends or contracts the directed selection; False moves a collapsed caret or collapses an existing selection

Return value

Returns 1 when an edit is active and its visual caret state is updated, otherwise 0

Example

Session.SetTextDirection(ftdAuto);
Session.MoveVisualCaret(False);
Session.MoveVisualCaret(True, True);

See also

GetVisualCaretOrder, SetTextDirection, SetSelectionRange, DispatchInputEvent, TPDFlibFormSession