Background image in dialog?

Participant ,
Aug 08, 2018

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, 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();

Capture d’écran 2018-08-08 à 18.55.47.png

TOPICS
Actions and scripting

Views

777

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Background image in dialog?

Participant ,
Aug 08, 2018

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, 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();

Capture d’écran 2018-08-08 à 18.55.47.png

TOPICS
Actions and scripting

Views

778

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 08, 2018 0
Adobe Community Professional ,
Aug 08, 2018

Copy link to clipboard

Copied

What is background image, and what dialog are you taking about?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 08, 2018 0
Most Valuable Participant ,
Aug 08, 2018

Copy link to clipboard

Copied

This is a scripting forum so I'll bet they mean a script's dialog using ScriptUI.

JJMack

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 08, 2018 0
Valorous Hero ,
Aug 08, 2018

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();

Capture d’écran 2018-08-08 à 18.55.47.png

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 08, 2018 0
Participant ,
Aug 08, 2018

Copy link to clipboard

Copied

Thank you very much Loic, that's exactly what I was asking

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 08, 2018 0
Most Valuable Participant ,
Aug 08, 2018

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.

JJMack

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 08, 2018 1
Valorous Hero ,
Aug 08, 2018

Copy link to clipboard

Copied

ScriptUI is both exciting and annoying. For more advanced dialogs, have a look at CEP Panels.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 08, 2018 0
Community Beginner ,
Dec 10, 2020

Copy link to clipboard

Copied

dont Work Were 😞

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 10, 2020 0