TdxLayoutSplitterItemMovedEvent Type
The procedural type for layout splitter movement events.
Declaration
TdxLayoutSplitterItemMovedEvent = procedure(Sender: TdxLayoutSplitterItem; AArgs: TdxLayoutSplitterItemMovedEventArgs) of object;
Parameters
Name | Type | Description |
---|---|---|
Sender | TdxLayoutSplitterItem | Provides access to the layout splitter that raised the movement event. |
AArgs | TdxLayoutSplitterItemMovedEventArgs | Provides access to information on the occurred layout splitter movement operation. You can use |
Remarks
Splitter movement events allow you to track state and position changes of layout items delimited by a splitter in a group.
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:
Accessible Event Parameters
Sender
- Allows you to identify and access the layout splitter that raised the event.
Args
Allows you to access layout items delimited by the
Sender
splitter and identify their boundaries before and after the splitter movement operation:Args
.NearItem |Args
.FarItem- Provide access to two layout items delimited by the splitter.
Args
.NewNearItemBounds |Args
.NewFarItemBounds- Return new boundaries of the delimited layout items.
Args
.OldNearItemBounds |Args
.OldFarItemBounds- Returns boundaries of the delimited layout items before the splitter movement operation.
Code Examples
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;
Keep Only One Grouped Layout Item Expanded at a Time
The code example in this section demonstrates OnClosed and OnOpened event handlers that allow you to keep only one layout item expanded within a layout group that contains items delimited by splitters. The form’s OnCreate event handler assigns the same event handlers to all splitters within the target group.
procedure TMyForm.SplitterItemClosed(Sender: TdxLayoutSplitterItem;
AArgs: TdxLayoutSplitterItemMovedEventArgs);
var
I: Integer;
begin
for I := 0 to dxLayoutGroup1.Count - 1 do
if((dxLayoutGroup1.Items[I].ClassType = TdxLayoutSplitterItem) and
(dxLayoutGroup1.Items[I] <> Sender)) then
if (dxLayoutGroup1.Items[I] as TdxLayoutSplitterItem).IsClosed then
(dxLayoutGroup1.Items[I] as TdxLayoutSplitterItem).Open;
end;
procedure TMyForm.SplitterItemOpened(Sender: TdxLayoutSplitterItem;
AArgs: TdxLayoutSplitterItemMovedEventArgs);
var
I: Integer;
begin
for I := 0 to dxLayoutGroup1.Count - 1 do
if ((dxLayoutGroup1.Items[I].ClassType = TdxLayoutSplitterItem) and
(dxLayoutGroup1.Items[I] <> Sender)) then
if not (dxLayoutGroup1.Items[I] as TdxLayoutSplitterItem).IsClosed then
(dxLayoutGroup1.Items[I] as TdxLayoutSplitterItem).Close;
end;
procedure TMyForm.FormCreate(Sender: TObject);
var
I: Integer;
begin
for I := 0 to dxLayoutGroup1.Count - 1 do
if(dxLayoutGroup1.Items[I].ClassType = TdxLayoutSplitterItem) then
begin
(dxLayoutGroup1.Items[I] as TdxLayoutSplitterItem).AllowCloseOnClick := True;
(dxLayoutGroup1.Items[I] as TdxLayoutSplitterItem).OnOpened := SplitterItemOpened;
(dxLayoutGroup1.Items[I] as TdxLayoutSplitterItem).OnClosed := SplitterItemClosed;
end;
end;
Direct TdxLayoutSplitterItemMovedEvent Type References
The following events reference the TdxLayoutSplitterItemMovedEvent
procedural type:
- TdxLayoutSplitterItem.OnClosed
- Allows you to respond to a splitter collapse operation.
- TdxLayoutSplitterItem.OnMoved
- Allows you to track splitter movements.
- TdxLayoutSplitterItem.OnOpened
- Allows you to respond to a layout splitter expand operation.