Click property of Picture is not working

Hi,

I am using click property of Picture Object. But it is not working.
Please help.

$go(go.Picture,dropDownImageStaticResource,
{
desiredSize: new go.Size(15, 12),
margin:0.2,
click: function(e, obj) {
var node=obj.part.adornedPart;
clickedOnNodeOpenDropDown(node.data.key);
}
)

Could you please be more specific about what the problem is? If you search for “click:” in the samples, you will find many examples of GraphObject.click event handlers, and they all work.

I didn’t get problem with click event of other Graph objects. But it is giving for Picture Graph Object.
Click event of Picture Object is not getting called.

I just tried your code in a Node template:

        , $(go.Picture, "http://gojs.net/latest/assets/images/screenshots/minimal.png",
            {
              desiredSize: new go.Size(15, 12),
              margin: 0.2,
              click: function(e, obj) {
                alert(obj.part.data.key);
              }
            })

I substituted a known image URL, and I changed the click behavior to just call alert.

It worked well.

Maybe you aren’t being careful about noticing what the bug appears to be – you are getting the obj.part, which will be a Part, but not an Adornment. So there is no .adornedPart.

$go(go.Adornment, “Spot”,
{
background: “transparent”
},
$go(go.Placeholder,
{
background: “transparent”
}),
$go(go.Picture,dropDownImageStaticResource,
{
desiredSize: new go.Size(12, 15),
margin:0.2,
alignment: new go.Spot(1,1,-3,-3),
alignmentFocus: new go.Spot(1,1,-3,-3),
click:function(e,obj) {
console.log(‘3231231’);
}
}
) );

I think because of adornment, it is not working.

Can you please check it now by substituting known image URL and check whether click function of Picture is working or not?

Thanks

I did in my earlier reply. And I guessed at what the problem was – that the click event handler is being called when it should be called, but that it is your use of getting the adornedPart property of something that did not support that property because it is not an Adornment.

And you can debug things yourself.