Drop Down List Populates UI

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
ScottHD
Posts: 11
Joined: June 14th, 2008, 9:22 pm
Location: South Carolina

There is an example script in the ScriptUI section of the Bridge Javascript PDF for creating dynamic content (page 81 & 82), it's as follows:

Code: Select all

res =
"dialog { \
whichInfo: DropDownList { alignment:'left' }, \
allGroups: Panel { orientation:'stack', \
info: Group { orientation: 'column', \
name: Group { orientation: 'row', \
s: StaticText { text:'Name:' }, \
e: EditText { preferredSize: [200, 20] } \
} \
}, \
workInfo: Group { orientation: 'column', \
name: Group { orientation: 'row', \
s: StaticText { text:'Company name:' }, \
e: EditText { preferredSize: [200, 20] } \
} \
}, \
}, \
buttons: Group { orientation: 'row', alignment: 'right', \
okBtn: Button { text:'OK', properties:{name:'ok'} }, \
cancelBtn: Button { text:'Cancel', properties:{name:'cancel'} } \
} \
}";
win = new Window (res);
win.whichInfo.onChange = function () {
if (this.selection != null) {
for (var g = 0; g < this.items.length; g++)
this.items[g].group.visible = false; //hide all other groups
this.selection.group.visible = true;//show this group
}
}
var item = win.whichInfo.add ('item', 'Personal Info');
item.group = win.allGroups.info;
item = win.whichInfo.add ('item', 'Work Info');
item.group = win.allGroups.workInfo;
win.whichInfo.selection = win.whichInfo.items[0];
win.center();
win.show();
The script has the groups stacked and changes with the drop down list selection.

How I need it to work is for instance in the first group: instead of

Code: Select all

e: EditText { preferredSize: [200, 20] } \
I need it to be a button instead of an EditText field as such:

Code: Select all

b: Button { preferredSize: [150, 20], text:'Render FLV', properties:{name:'render'} } \
However I need for that button to run my render function:

Code: Select all

function renderSelectedCompFLV()
{
//Based off of: http://www.nabscripts.com/Scripting/Partie5_1.htm
myProj = app.project;
      myComp = myProj.activeItem;
      myRenderQueue = myProj.renderQueue;
      myQueueItem = myRenderQueue.items.add(myComp);
	  
	  myQueueItem.applyTemplate("Best Settings");

      myOM = myQueueItem.outputModule(1);
      myOM.applyTemplate("320x240 FLV");
	  
	  myQueueItem.logType = LogType.ERRORS_AND_SETTINGS;
	  
	  myPath = folderGetDialog("Choose a destination...");
      myOM.file = new File(myPath.toString() + "/[projectName].[fileExtension]");
	  
myRenderQueue.render();

myQueueItem.remove();
}
Choosing a different selection in the drop down list would bring up the second item in the group list but that button would call a different render function that has different Output Module settings.

I have been trying for a couple days now to get the button to run the specified function. I've tried in both the res group section and in the new Window section of the code. I might just be over looking something. Is there a better way to do dynamic groups and panels? Or am I on the right track? Thanks in advance!
ScottHD
Posts: 11
Joined: June 14th, 2008, 9:22 pm
Location: South Carolina

7/18/08 Edit:
After alot of digging, reading, and coding I finally have a working script for this dynamic drop down interface, it's really nice!

If anyone is interested I can post part of the code.
Post Reply