in previous versions it was possible to call a function when an image in a dialog got clicked, see the example below.
I can't reconstruct in which version it did stop working. I am pretty sure it did still work in build 10.3.1.387.
Code: Select all
// to execute paste for example in javascript console
{
// function to create icon data
const getIcon = (hex) => {
return {
count: 0,
width: 64,
height: 64,
read: function(nBytes) {
return hex.slice(this.count, this.count += nBytes);
}
}
};
// test image data (blue square)
const blueImgHex = 'ff0000ff'.repeat(64*64);
// dialog
const dialog = {
initialize: function(dlg) {
dlg.load({img1: getIcon(blueImgHex)}); // initialize img1 with image data
},
description: {
name: 'Test', elements: [
{ type: 'image', item_id: 'img1', height: 64, width: 64 } // define image element
]
},
img1: function(dlg) {
// this did execute before, when element img1 was clicked, but it doesn't in
// xce version 10.5.2 build 395
console.println('image clicked');
// expected behaviour is a console output when the image is clicked
// currently nothing happens
}
};
// show the dialog
app.execDialog(dialog);
}
Kind regards
benep