Skip to main content

TdxCustomNavBar.GetGroupAtCaptionPos(TPoint) Method

Returns the group whose header is located under the specified point.

Declaration

function GetGroupAtCaptionPos(const pt: TPoint): TdxNavBarGroup;

Parameters

Name Type
pt TPoint

Returns

Type
TdxNavBarGroup

Remarks

Call this function to identify the group whose header is located under the specified point. If the pt parameter specifies a point over a group header, the corresponding group is returned. Otherwise, the GetGroupAtCaptionPos function returns nil. Thus, you can compare the function’s return value to nil to determine whether the point is over a group header.

Note

the point must be specified in the control’s client coordinates (i.e. relative to the top-left corner of the NavBar control).

The sample code below handles the OnMouseMove event of the NavBar control to determine whether the mouse pointer is over a group header. If so, an explanatory message is displayed within the status bar. (Note that you must have a status bar with at least one panel added to use this example.)

procedure TfrmNavBarDemo.dxNavBarMouseMove(Sender: TObject;
  Shift: TShiftState; X, Y: Integer);
var
  APoint: TPoint;
  AGroup: TdxNavBarGroup;
begin
  APoint := Point(X, Y);
  AGroup := dxNavBar.GetGroupAtCaptionPos(APoint);
  if AGroup = nil then
  begin
    StatusBar1.Panels[0].Text := '';
    Exit;
  end;
  if AGroup.OptionsExpansion.Expanded then
    StatusBar1.Panels[0].Text := 'Click to collapse the ' + AGroup.Caption + ' group'
  else
    StatusBar1.Panels[0].Text := 'Click to expand the ' + AGroup.Caption + ' group';
end;
See Also