Skip to main content
All docs
V25.1
  • TdxLayoutSplitterItemMovedEventArgs.NearItem Property

    Provides access to the adjacent near layout item.

    Declaration

    property NearItem: TdxCustomLayoutItem read; write;

    Property Value

    Type Description
    TdxCustomLayoutItem

    The near layout item associated with the splitter that raised the OnClosed, OnMoved, or OnOpened event.

    You can use OldNearItemBounds and NewNearItemBounds properties to identify near item dimensions after a splitter resize, expand, or collapse operation.

    Remarks

    Use FarItem and NearItem properties to identify and access layout items delimited by the splitter that raised the OnClosed, OnMoved, or OnOpened event.

    Near, Far, and Target Layout Items

    Near and far item positions depend on the parent layout group‘s LayoutDirection property value:

    ldVertical
    Default. The group arranges items from top to bottom. The near item is above the splitter, and the far item is below it.
    ldHorizontal
    The group arranges items from left to right. Near and far items are to the left and right of a splitter, respectively.

    The target item is the near or far layout item associated with the splitter, depending on AlignVert and AlignHorz property values as well as the parent group direction.

    For example, the near item is the splitter target if the parent group is horizontally arranged, and the AlignHorz property is set to ahLeft:

    VCL Layout Control: A Splitter and Delimited Layout Groups

    Code Example: Track Splitter Movement

    The following code example demonstrates an OnMoved event handler that displays names and sizes of layout items delimited by the currently dragged splitter in a horizontally arranged layout group:

    procedure TMyForm.dxLayoutSplitterItem1Moved(
      Sender: TdxLayoutSplitterItem; AArgs: TdxLayoutSplitterItemMovedEventArgs);
    begin
      Caption := AArgs.NearItem.Name + ' Item Width: ' + IntToStr(AArgs.NewNearItemBounds.Width) + ' ' +
        AArgs.FarItem.Name + ' Item Width: ' + IntToStr(AArgs.NewFarItemBounds.Width);
    end;
    
    See Also