Reputation: 115
I use a virtualtreeview, and I want to show differents messages into the component, regardless columns, when no node visible.
Have you some idea to do this? Thank you.
Upvotes: 2
Views: 161
Reputation: 76753
Write a handler for the OnPaintBackground
event. For example:
procedure TForm1.VirtualStringTreePaintBackground(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas; R: TRect; var Handled: Boolean);
begin
if Sender.VisibleCount = 0 then
begin
Handled := True;
TargetCanvas.TextOut(10, 10, 'List has no visible nodes.');
end;
end;
If you are interested in showing a text when the control is empty (not just when their nodes are hidden), you can use the EmptyListMessage
property.
Upvotes: 4