Skip to main content

TcxCustomTreeView.ToolTips Property

Specifies whether tooltips are displayed for nodes whose contents don’t fit into the control’s area.

Declaration

property ToolTips: Boolean read; write; default True;

Property Value

Type Default
Boolean True

Remarks

The image below shows an example of a tooltip.

Tip

If you need to display node hints, you need to handle the OnHint event of the application object. The event handler must determine the hovered node using the GetNodeAt method of the tree view and assign the appropriate hint to the control’s Hint property. Note that the tree view’s ShowHint property must be set to True and a non-empty string must be assigned to the Hint property so that the OnHint event can be raised.

The code below is an example of assigning hints to nodes of a tree view. Hints will display the list of child nodes. The OnMouseMove event is handled in the following manner:

procedure TForm1.cxTreeView1MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
var
  Node: TTreeNode;
  I: Integer;
begin
  Node := cxTreeView1.GetNodeAt(X, Y);
  if (Node = nil) or (Node = PrevNode) then Exit;
  PrevNode := Node;
  cxTreeView1.Hint := 'Children list:';
  for I := 0 to Node.Count - 1 do
    cxTreeView1.Hint := cxTreeView1.Hint + #13#10 + '- ' + Node.Item[I].Text;
  if not Node.HasChildren then cxTreeView1.Hint := 'No children';
  Application.ActivateHint(cxTreeView1.ClientToScreen(Point(X, Y)));
end;

Here, PrevNode is the global variable that is assigned nil in the form’s OnCreate event handler.

var
  PrevNode: TTreeNode;
procedure TForm1.FormCreate(Sender: TObject);
begin
  PrevNode := nil;
end;

Upon execution, the result is as follows:

The default value of the ToolTips property is False.

See Also