Dear script developers,
I’m trying to embed graphics in my UI. So far I’ve tryed the method described by Peter Kahrel in appendix 1 of his ScriptUI For Dummies, and it works for floating GUI.
But I would like to make Dockable GUI. To build the UI, I use the ressource string method that I’ve found on this forum (many thanks to David Torno) but I still can’t figure how to embed graphics in the layout.
Here is what I’ve tryed:
{
function myScript(thisObj) {
function myScript_buildUI(thisObj) {
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "My Panel Name", [0, 0, 300, 300]);
var myIcon = "\u0089PNG\r\n\x1A\n\x00 etc etc"; //this is where I paste the image data
res="group{orientation:'row', alignment:['left', 'top'], alignChildren:['center', 'center'],\
myPanel1: Panel{text:'Panel1 Name', orientation:'column', alignChildren:['center', 'center'],\
myPanelItem1: IconButton{image:'"+myIcon+"'},\
},\
},\
}"
myPanel.grp = myPanel.add(res);
myPanel.grp.myPanel1.myPanelItem1.onClick = function(){alert('yo')};
myPanel.layout.layout(true);
myPanel.grp.minimumSize = myPanel.grp.size;
myPanel.layout.resize();
myPanel.onResizing = myPanel.onResize = function () {this.layout.resize();}
return myPanel;
}
var myScriptPal = myScript_buildUI(thisObj);
if ((myScriptPal != null) && (myScriptPal instanceof Window)) {
myScriptPal.center();
myScriptPal.show();
}
}
myScript(this);
}
Is there a way to make this works or should I forget about the ressource string method to put images in my GUI?