TRubberbandLayer.OnConstrain

property OnConstrain: TRBConstrainEvent;

type TRBConstrainEvent = procedure(
  Sender: TObject;
  const
OldLocation: TFloatRect;
  var NewLocation: TFloatRect;
  DragState: TDragState;
  Shift: TShiftState) of object;

type TDragState = (dsNone, dsMove, dsSizeL, dsSizeT, dsSizeR, dsSizeB, dsSizeTL, dsSizeTR, dsSizeBL, dsSizeBR);

Description

When Options contains roConstrained the OnConstrain event allows for constraining the size and position of the rubber band while it is being moved or resized using the mouse. This event is called only when the user clicks and drags the layer with the mouse, it is not generated when you set the Location property explicitly. It is called before OnResizing and proportional resizing (roProportional in Options).

OldLocation specifies location of the layer before the user started dragging it.

NewLocation determines the new location of the rubber band. You may change the coordinates to constrain to a certain given maximum or minimum.

The DragState parameter indicates how the layer is being dragged/resized.

Shift indicates the state of the Alt, Ctrl, and Shift keys.

See Also

TPositionedLayer.Location, OnResizing, Options