mad8834671
mad8834671

Reputation: 3

How to disable expand in Virtualstringtree dblclick

I want to implement other events in virtualstringtree dblcick, No need to expand/collapse in dblcick, only need to use +/- to expand/collapse

Upvotes: 0

Views: 291

Answers (1)

HeartWare
HeartWare

Reputation: 8261

Include this code above your form's definition in your .PAS source:

type   
  TVirtualStringTree = class(VirtualTrees.TVirtualStringTree)
                          procedure HandleMouseDblClick(var Message: TWMMouse; const HitInfo: THitInfo); override;
                       end;

and the implementation of the HandleMouseDblClick should be:

procedure TVirtualStringTree.HandleMouseDblClick(var Message: TWMMouse; const HitInfo: THitInfo);
begin
  DoNodeDblClick(HitInfo)
end;

It will then (only) call the OnNodeDblClick event handler on a DoubleClick event, where you can do what you need. You may need to investigate the HitInfo parameter to determine if a node was truly clicked (and not just the white area). I'll leave that up to you :-)

Upvotes: 1

Related Questions