How to select node programmatic


I have to select node based of node data array. Is there any method (in node or part) which make that selection and shows node as selected in diagram (without user to click on that node)?

I tried isSelected(=true) on node, which makes it selected on diagram but it does not fire any event which does not make event listener to execute bound function.


It seems diagram select method is firing ChangedSelection event. But subject part is empty in event passed . However single click on that node passes GraphObject in event with proper data. How can we get same subject passed (or get hold of) in both ObjectSingleClicked and ChangedSelection event to have same behavior (either select by click or select through program)

Yes, the method will make the one given part the only selected part. The “ChangedSelection” DiagramEvent is raised, from which you can look at the Diagram.selection and see what is selected. That selection collection might be empty, might have only one Part in it (which would be the case after a call to, or might have many Parts in it.