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

Create compatible window for different monitors/screens resolutions

Explorer ,
Nov 27, 2017 Nov 27, 2017

I want to create a compatible window for run different monitor/screens. In below window, I have given hard-coded values for positions and buttons length.

var dlg = new Window("dialog", "Patient List"); 

dlg.frameLocation = [100,100]; // position 

dlg.size = [500, 250]; 

 

 

//table initailize  

var w0=150, w1=150 ; 

     

table = dlg.add ("listbox", {x:20, y:20, width:300, height:150}, undefined, { numberOfColumns:6, showHeaders:true,  

columnWidths: [w0,w1],  

columnTitles:["First Name", "Last Name"] });

dlg.btnRightGroup = dlg.add ("group", {x:350, y:20, width:130, height:200});

btnNew = dlg.btnRightGroup.add("button", {x:0, y:0, width:130, height:20}, "New");

btnEdit = dlg.btnRightGroup.add("button", {x:0, y:25, width:130, height:20}, "Edit");

dlg.editGroup = dlg.add ("group", {x:20, y:175, width:500, height:25})

editAnimationName = dlg.editGroup.add ("edittext", {x:0, y:0, width:150, height:20});

editStart = dlg.editGroup.add ("edittext", {x:151, y:0, width:150, height:20});

btnUpdate = dlg.editGroup.add("button", {x:325, y:0, width:130, height:20}, "Update");

dlg.btnBottomGroup = dlg.add ("group", {x:150, y:200, width:500, height:30})

btnOk = dlg.btnBottomGroup.add("button", {x:0, y:10, width:100, height:20}, "Ok");

btnCancel = dlg.btnBottomGroup.add("button", {x:150, y:10, width:100, height:20}, "Cancel");

 

 

table.add("item", "Namodaya");  

table.items[0].subItems[0].text = "Balaarachchi"; 

   

dlg.show();

Capture.PNG

I want to create compatible (Responsive) window. Please help me to find any reference to learn that one.

TOPICS
Actions and scripting
972
Translate
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
Adobe
Guide ,
Nov 27, 2017 Nov 27, 2017

Do you mean something like this...?

    var dlg = new Window("dialog", "Patient List");   

    dlg.frameLocation = [100,100]; // position   

    dlg.size = [500, 250];   

       

       

    //table initailize    

    var w0=150, w1=150 ;   

    New = false;      

     table = dlg.add ("listbox", {x:20, y:20, width:300, height:150}, undefined, { numberOfColumns:2, showHeaders:true,    

     columnWidths: [w0,w1],    

     columnTitles:["First Name", "Last Name"] });  

     

     

    dlg.btnRightGroup = dlg.add ("group", {x:350, y:20, width:130, height:200}); 

    btnNew = dlg.btnRightGroup.add("button", {x:0, y:0, width:130, height:20}, "New");  

    btnEdit = dlg.btnRightGroup.add("button", {x:0, y:25, width:130, height:20}, "Edit"); 

     

    dlg.editGroup = dlg.add ("group", {x:20, y:175, width:500, height:25})  

    editAnimationName = dlg.editGroup.add ("edittext", {x:0, y:0, width:150, height:20});  

    editStart = dlg.editGroup.add ("edittext", {x:151, y:0, width:150, height:20});  

    btnUpdate = dlg.editGroup.add("button", {x:325, y:0, width:130, height:20}, "Update"); 

     

     

    dlg.btnBottomGroup = dlg.add ("group", {x:150, y:200, width:500, height:30}) 

    btnOk = dlg.btnBottomGroup.add("button", {x:0, y:10, width:100, height:20}, "Ok");  

    btnCancel = dlg.btnBottomGroup.add("button", {x:150, y:10, width:100, height:20}, "Cancel"); 

       

       

    table.add("item", "Namodaya");    

    table.items[0].subItems[0].text = "Balaarachchi";   

  

   btnEdit.onClick=function(){

       New = false;

       try{

      editAnimationName.text = table.selection.text;

      editStart.text = table.selection.subItems[0];

      }catch(e){alert("You must select an item first!");return;}

      }   

  btnUpdate.onClick=function(){

      if(!New){

            table.selection.text=editAnimationName.text; 

            table.selection.subItems[0].text = editStart.text;

            editAnimationName.text ="";

            editStart.text="";

            }else{

                var count = table.items.length;

                table.add("item",editAnimationName.text);

                table.items[count].subItems[0].text = editStart.text;

                editAnimationName.text ="";

                editStart.text="";

                New = false;

                }

            }

        btnNew.onClick=function(){

            New=true;

            editAnimationName.text = "Forename";

            editStart.text = "Last Name";

            }

     dlg.show(); 

Translate
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 ,
Nov 27, 2017 Nov 27, 2017

Thank you for the quick response. Actually, I want to create a compatible window for run different monitor/screens.

That means following I gave hardcoded values,

  • dlg.frameLocation = [100,100]     
  • dlg.size = [500, 250]
  • table size = {x:350, y:20, width:130, height:200}
  • button sizes = {x:151, y:0, width:150, height:20}

When I run it on the different monitor (differenct screen resolution) its took different place and not compatible for that screen (relative dimenstions).

I want to create this window compatible with every computer.

Do you have any idea about this?

Translate
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
Guide ,
Nov 27, 2017 Nov 27, 2017

Sorry I only have the one monitor, I am sure someone will come and help out.

Translate
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 ,
Nov 27, 2017 Nov 27, 2017

Ok. Thank you very much SuperMerlin​

Translate
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 ,
Nov 27, 2017 Nov 27, 2017

You can use the object $ (see the documentation) and its properties

$.screens[0].bottom;

$.screens[0].right;

$.screens[0].primary

to find out the screen resolution.

P.S. Your code will not work in versions CC2018, 2017 and 2015.5 at least, because they have broken multicolumn listboxes and also frameLocation.

Translate
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 ,
Nov 27, 2017 Nov 27, 2017
LATEST

r-bin  wrote

P.S. Your code will not work in versions CC2018, 2017 and 2015.5 at least, because they have broken multicolumn listboxes and also frameLocation.

So do you have any idea how to create a table for support Photoshop CC 2014, 2015.1 and 2015.5?

Translate
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