Page 1 of 1

ScriptUI element sizing nightmares :-O

Posted: Fri Dec 01, 2017 1:21 am
by Chucksef
Hi all!

My first post, so forgive my many likely dumb things say.

I'm trying to use a Reference string to build a panel in ScriptUI and I'm just NOT understanding (probably) a TON of things about sizing and location properties. Specifically: a panel I'm messing with just isn't resizing like I expect it to. Here's my code. It's a lot (to me), and easily the largest project like this I've ever attempted, so forgive the roughness of it all.

The problem is located about 1/3 of the way down. there's a Panel called, "pnl_Rename" that contains another panel called, "Header," and boy this thing just isn't obeying my size: or location: instructions. HELP HELP HELP I'm so lost!

-Chucksef

Code: Select all



#target Photoshop
var dlg_Main, MainUI, pnl_Main, pnl_Rename;

////////////////////
//Some UI Elements//
////////////////////

MainUI = "dialog {\
orientation: 'stack',\
alignment: ['center','center'],\
text: 'Allbox File Manager',\
margins:15,\
\
\
pnl_Main: Panel{\
orientation: 'column',\
alignment:['fill','center'],\
margins:15,\
\
st: StaticText { \
alignment: 'center', \
text: 'Welcome to Allbox File Manager Choose an Option Below', \
justify: 'center',\
size: [200,32],\
properties: {multiline: 'True'} \
}\
btn_Rename: Button {\
text:'Rename and Sort',\
properties:{name:'btn_Rename'},\
alignment:['center', 'center'],\
size: [150,50],\
helpTip: 'Primary tool to rename image files and sort them into classroom folders',\
}\
btn_ID: Button {\
text:'Create IDs and Resize',\
properties:{name:'btn_ID'},\
alignment:['center', 'center'],\
size: [150,50],\
enabled: false,\
helpTip: 'Tools to help build an ID folder and/or resize files'\
}\
btn_ID: Button {\
text:'Build Yearbook Folder',\
properties:{name:'btn_YBCD'},\
alignment:['center', 'center'],\
size: [150,50],\
enabled: false,\
helpTip: 'Tools to help you build a Yearbook folder or final combined groomed folder'\
}\
btn_Cancel: Button {\
text:'Exit',\
properties:{name:'cancel'},\
alignment:['center', 'center'],\
size: [150,50],\
helpTip: 'Exits the application'\
}\
}\
\
\
pnl_Rename: Panel{\
margins:0,\
alignment: 'fill',\
alignChildren: ['center','top'],\
spacing: 5,\
\
Header: Panel {\
alignment: ['left','top'],\
size: [300,45],\
spacing: 25,\
margins:0,\
\
btn_Help: Button {\
text:'Help',\
alignment:['center', 'center'],\
size: [10,25],\
helpTip: 'Instructions for how to use this screen',\
}\
st_Title: StaticText { \
text: 'RENAME AND SORT', \
size: [100,25],\
}\
btn_Menu: Button {\
text:'Main Menu',\
properties:{name:'btn_Back'},\
alignment:['center', 'center'],\
size: [100,25],\
helpTip: 'Return to the Main Menu'\
}\
}\
grp_HR1: Group {\
orientation: 'column',\
alignment: ['center','top'],\
margins:0,\
spacing:2,\
\
hr1: Panel {size: [496,6]}\
hr2: Panel {size: [496,6]}\
}\
\
Step1label: StaticText {text:'Step 1: Select the folder that contains your un-named images'}\
Step1: Group {\
alignment: ['center','top'],\
alignChildren: 'left',\
margins:10,\
\
leftcol1: Group {\
orientation: 'column',\
size: [120,40],\
alignChildren: ['right','top'],\
\
btn_SelectFolder: Button {\
text:'Select Folder',\
size: [105,40],\
helpTip: 'Opens a window to choose the folder'\
}\
}\
rightcol1: Group {\
orientation: 'column',\
alignment: 'fill',\
alignChildren: 'fill',\
\
et_SelectFolder: EditText {\
alignment: ['left','top'],\
text: 'Click the button to select your folder',\
size: [250,40],\
enabled: false,\
properties: {readonly:true},\
}\
}\
}\
grp_spacer1: Group {size: [1,20],bts:StaticText{size:[26,26]}}\
grp_HR2: Group {\
orientation:'column',\
margins:0,\
spacing:2,\
alignment: ['center','top'],\
\
hr3: Panel {size: [496,6]}\
}\
\
Step2label: StaticText {text:'Step 2: Select a tab-separated text file that will provide our data'}\
Step2: Group {\
alignment: ['center','top'],\
alignChildren: 'left',\
margins:10,\
\
leftcol2: Group {\
orientation: 'column',\
size: [120,40],\
alignChildren: ['right','top'],\
\
btn_SelectData: Button {\
text:'Select Database',\
size: [105,40],\
helpTip: 'Opens a window to choose your database'\
}\
}\
rightcol2: Group {\
orientation: 'column',\
alignment: 'fill',\
alignChildren: 'fill',\
\
et_SelectData: EditText {\
alignment: ['left','top'],\
text: 'Click the button to choose your data',\
size: [250,40],\
enabled: false,\
properties: {readonly:true},\
}\
}\
}\
grp_spacer2: Group {size: [1,20],stt:StaticText{size:[26,26]}}\
grp_HR3: Group {\
orientation:'column',\
margins:0,\
spacing:2,\
alignment: ['center','top'],\
\
hr4: Panel {size: [496,6]}\
}\
\
Step3label: StaticText {text:'Step 3: Run the Parser to ensure proper data interpretation'}\
grp_Parse: Group {\
btn_Parse: Button {\
text:'Parse Data',\
alignment:['center', 'center'],\
size: [105,40],\
helpTip: 'Launch a tool to help Allbox interpret your data'\
}\
}\
\
Step4label: StaticText {text:'Step 4: Run the Parser to ensure proper data interpretation'}\
grp_Parse: Group {\
margins:10,\
btn_Parse: Button {\
text:'Parse Data',\
alignment:['center', 'center'],\
size: [105,40],\
helpTip: 'Launch a tool to help Allbox interpret your data'\
}\
}\
btn_Run: Button {\
text:'Run',\
alignment:['center', 'center'],\
size: [105,40],\
helpTip: 'Launch a tool to help Allbox interpret your data'\
}\
}\
}"

dlg_Main = new Window(MainUI);

var d = dlg_Main;
var dmm = dlg_Main.pnl_Main;
var drn = dlg_Main.pnl_Rename;

//Main Menu Functions
dmm.btn_Rename.onClick = function() {
dmm.hide();
drn.show();
drn.size = [500,700];
drn.Header.size = [470,45];
d.size = [530,730];
d.center();

};
dmm.btn_Cancel.onClick = function() {
dlg_Main.close();
};

//Rename And Sort Functions
drn.Header.btn_Menu.onClick = function() {
drn.hide();
dmm.show();
d.size = [280,450];
d.center();
}

//TEST FUNCTIONS


//LET'S START THE SHOW!
drn.hide();
d.size = [280,450];
d.show();