Clarification regarding selection

Hi,

Below is my structure for creating a diagram:
Node -> Panel -> Panel -> Shape -> TextBlock.

We have also added DiagramListener for events: “ObjectSingleClicked” and “ChangedSelection”. On top of this, currently I am planning to implement a “Click” binding for TextBlocks. Hence I just wanted to make sure what will the execution order of these callbacks? Which events will be triggered and in what order? Will it be always consistent?

Please let me know. Thank you.

The “ChangedSelection” DiagramEvent happens whenever the Diagram.selection has changed, so it is independent of whether any particular Node is selected or TextBlock is clicked. But under normal circumstances selection happens before any click events.

Any “…Clicked” DiagramEvent will happen before any GraphObject…click or Diagram…click event handler is called. That is true for single, double, and context clicks.

Thank you for the confirmation @walter. That’s all I needed. :)

Hi @walter. I have another doubt related to the same diagram. In the above mentioned structure, how can I find the Shape and TextBlock using there names? Is there any method for this?

If you have set the GraphObject.name on each of the objects that you want to refer to later in your code, you can call Panel.findObject on the Node, with the name you gave it.
https://gojs.net/latest/learn/graphobject.html

Thank you. :)