Copy link to clipboard
Copied
Hi,
I wrote some years ago a javascript, which worked fine up to PS CC 2014. Recently I tried to run it in PS CC 2018 and it failed. The script creates a window with various panels containing various buttons and checkboxes. In CC 2018 only the main window and the panels show up, but not the elements within the panels. Code like
win.pnl01.selFolderButton = win.add("button",[320, 140, 420, 160] , "SELECT");
is obviously ignored.
Any suggestions?
Thanks.
You're adding the buttons to the main win. You need to specify that you're adding them to the panel in the add comment
win.pnl01.selFolderButton = win.pnl01.add("button", [320, 140, 420, 160] , "Select");
Copy link to clipboard
Copied
That line looks fine, so it's hard to tell without seeing more of the code.
Copy link to clipboard
Copied
app.preferences.rulerUnits = Units.CM;
var win = new Window("dialog", "GUINEA PIG", [150, 150, 600, 900]);
win.pnl01 = win.add("panel", [10,10,440,180], 'Select a folder');
win.pnl01.selFolderButton = win.add("button", [320, 140, 420, 160] , "Select");
win.pnl01.selFolderToCheckTxt = win.add("statictext",[30,50,430,90], "None yet selected");
win.show ();
I broke the code up and wrote this basic script, saved and ran it. This is the result:
Copy link to clipboard
Copied
You're adding the buttons to the main win. You need to specify that you're adding them to the panel in the add comment
win.pnl01.selFolderButton = win.pnl01.add("button", [320, 140, 420, 160] , "Select");
Copy link to clipboard
Copied
Problem solved, thank you. Has this changed? The code worked before CC 2018, I just copied it for the posted GUINEA PIG.
I had to fix the coordinates as well, since the values now are relative to the panel.
Copy link to clipboard
Copied
I don't think it changed. AFAIK, you always had to state the exact panel or group in which a control is to be placed.
Copy link to clipboard
Copied
This works in CS6 but not in CC2018
var win = new Window("dialog", "GUINEA PIG", [150, 150, 600, 900]);
win.add("panel", [10,10,440,180], 'Select a folder');
win.add("button", [320, 140, 420, 160] , "Select");
win.add("statictext",[30,50,430,90], "None yet selected");
win.show ();
This works in CC2018 but not in CS6
var win = new Window("dialog", "GUINEA PIG", [150, 150, 600, 900]);
win.add("button", [320, 140, 420, 160] , "Select");
win.add("statictext",[30,50,430,90], "None yet selected");
win.add("panel", [10,10,440,180], 'Select a folder');
win.show ();
Changed the order of drawing. Therefore, the panel overlaps the rest of the elements.