Copy link to clipboard
Copied
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();
I want to create compatible (Responsive) window. Please help me to find any reference to learn that one.
Copy link to clipboard
Copied
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();
Copy link to clipboard
Copied
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,
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?
Copy link to clipboard
Copied
Sorry I only have the one monitor, I am sure someone will come and help out.
Copy link to clipboard
Copied
Ok. Thank you very much SuperMerlin​
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?