Hi, is there any way to select a treeitem when using PopupMenu?
Something like ContextPopup?
Add a TPopupMenu on the form with a menu item to perform the select and use following code
var
contextnode: TTMSFMXTreeviewVirtualNode;
procedure TForm1.MenuItem1Click(Sender: TObject);
begin
if Assigned(contextnode) then
TMSFMXTreeView1.SelectNode(contextnode.Node);
end;
procedure TForm1.TMSFMXTreeView1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Single);
var
pt: TPointF;
begin
if Button = TMouseButton.mbRight then
begin
contextnode := TMSFMXTreeView1.XYToNode(x,y);
if Assigned(contextnode) then
begin
pt := ClientToScreen(pointf(TMSFMXTreeView1.Position.x + x,TMSFMXTreeView1.Position.y + y));
PopupMenu1.Popup(pt.X, pt.Y);
end;
end;
end;