I added this context men in my nodeTemplate definition, i want to know how i can get the shape object in this case ?
The second argument to a GraphObject.click event handler will be the GraphObject where the event handler was declared. (The event handler might be reached after bubbling up the click event.)
obj will be the “ContextMenuButton”.
obj.part will be the context menu Adornment.
So, does your context menu have a “SHAPE” declared in it? Probably not – you really should be looking for the “SHAPE” in the adorned Node.
Ok how to look for the “SHAPE” in the adorned node if i want to change the shape color of the node when i click on the button in the context menu ?
And how to get Panel object ?
that’s the node
Excuse me but i am new to gojs, i didn’t understand what you say, do you mean that i should do this :
var shape = node.findObject(“SHAPE”);
because this’s not working.
By “not working”, are you saying that the call returns null? That implies that the node template does not have an element with GraphObject.name set to “SHAPE”.
yes the call returns null, this is the definition of node template
So as you can see the node have shape element, but is there any way to set the name to “SHAPE” ?