Copy link to clipboard
Copied
Hello,
I know a dialog background color can easily be changed but, just to be sure, there is no way to add a background image to a dialog?
Thank you.
Go frenzy…
...Image.prototype.onDraw = function()
{ // written by Marc Autret
// "this" is the container; "this.image" is the graphic
if( !this.image ) return;
var WH = this.size,
wh = this.image.size,
k = Math.min(WH[0]/wh[0], WH[1]/wh[1]),
xy;
// Resize proportionally:
wh = [k*wh[0],k*wh[1]];
// Center:
xy = [ (WH[0]-wh[0])/2, (WH[1]-wh[1])/2 ];
this.graphics.drawImage(this.image,xy[0],xy[1],wh[0],wh[1]);
WH = wh = xy = null;
}
var w =new Window( 'dialog' );
var g = w.add('group');
var u;
var i = g.add ('image', u
Copy link to clipboard
Copied
What is background image, and what dialog are you taking about?
Copy link to clipboard
Copied
This is a scripting forum so I'll bet they mean a script's dialog using ScriptUI.
Copy link to clipboard
Copied
Go frenzy…
Image.prototype.onDraw = function()
{ // written by Marc Autret
// "this" is the container; "this.image" is the graphic
if( !this.image ) return;
var WH = this.size,
wh = this.image.size,
k = Math.min(WH[0]/wh[0], WH[1]/wh[1]),
xy;
// Resize proportionally:
wh = [k*wh[0],k*wh[1]];
// Center:
xy = [ (WH[0]-wh[0])/2, (WH[1]-wh[1])/2 ];
this.graphics.drawImage(this.image,xy[0],xy[1],wh[0],wh[1]);
WH = wh = xy = null;
}
var w =new Window( 'dialog' );
var g = w.add('group');
var u;
var i = g.add ('image', u, File(Folder.desktop+"/campagne.jpeg" ) );
w.margins = 0;
g.orientation = "stack";
w.alignChildren = g.alignChildren = ["fill","fill"];
var mainGp = g.add('group');
mainGp.margins = 5;
mainGp.alignChildren = ["left", "top" ];
mainGp.add('edittext', u, 'What a nice background…');
mainGp.add('checkbox', u, 'Do you like it ?');
w.onDraw = function() {
i.size = w.size;
}
w.show();
Copy link to clipboard
Copied
Thank you very much Loic, that's exactly what I was asking
Copy link to clipboard
Copied
That works in CC 2014 but not in CC 2018. A jpeg seems to be invalid data in CC 2018 changing to a PNG an image will display in the the dialog but the dialog is the wrong size and aspect ratio and dialog element are missing. Adobe replaced ScriptUI in CC 2015 and there are problems in the new ScriptUI.
Copy link to clipboard
Copied
ScriptUI is both exciting and annoying. For more advanced dialogs, have a look at CEP Panels.
Copy link to clipboard
Copied
dont Work Were 😞