• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Background image in dialog?

Contributor ,
Aug 08, 2018 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.

TOPICS
Actions and scripting

Views

1.3K

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
community guidelines

correct answers 1 Correct answer

People's Champ , Aug 08, 2018 Aug 08, 2018

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

...

Votes

Translate

Translate
Adobe
LEGEND ,
Aug 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Community Expert ,
Aug 08, 2018 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

Votes

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
community guidelines
People's Champ ,
Aug 08, 2018 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

Votes

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
community guidelines
Contributor ,
Aug 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Community Expert ,
Aug 08, 2018 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

Votes

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
community guidelines
People's Champ ,
Aug 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Explorer ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

LATEST

dont Work Were 😞

Votes

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
community guidelines