Hi, I am having a few issues with my listbox UI.
It is looking pretty good but there are a few issues:
a) no close button ( I have closeButton: true in my script)
b) I can't copy the data to the clipboard (I can select the items but they don't make it into the clipboard)
c) I can't get the headings in the list box ( I tried this).
var list = dlg.add ("ListBox", [0, 0, 400, box_height], "a", {numberOfColumns: 5, showHeaders: true, columnTitles: ["Layer", "In", "Out"], multiselect: true});
And I get an "uncaught exception add" error.
Below is my script, any help would be great.
Cheers.
Phil
var myComp = app.project.activeItem;
var myLayers = myComp.selectedLayers;
var dlg = new Window("dialog", "Analyze Edit", undefined, {closeButton: true});
var box_height = myLayers.length *17;
var list = dlg.add ("ListBox", [0, 0, 400, box_height], "a", {numberOfColumns: 5, multiselect: true});
for (var i = 0; i <= myLayers.length -1 ; i++){
var layerName = myLayers.name;
var layer_in = myLayers.inPoint / myComp.frameDuration;
var layer_out = myLayers.outPoint / myComp.frameDuration;
var layer_time = myLayers.startTime / myComp.frameDuration ;
var source_name = layerName;
var source_in = Math.ceil(layer_in - layer_time);
var source_out = Math.ceil(layer_out - layer_time);
var item1 = list.add ("item");
item1.subItems[0].text =i+1;
item1.subItems[1].text = source_name;
item1.subItems[2].text = source_in;
item1.subItems[3].text = source_out;
} //end loop
dlg.show();
Listbox Woes
Moderator: Paul Tuersley
-
- Posts: 39
- Joined: November 2nd, 2005, 10:20 am
- Contact:
Phil Spitler
I just posted my solution for the Extendscript vs. AE error you had at :
http://www.aenhancers.com/viewtopic.php?f=8&t=1787
Here's the code again though:
As for the Close button modify the "res" variable like so:
The function of the Close button would be like so:
http://www.aenhancers.com/viewtopic.php?f=8&t=1787
Here's the code again though:
Code: Select all
{
var res = "dialog\
myListbox: ListBox { alignment:['fill','fill'], properties:{\
multiselect:true, \
numberOfColumns:5, \
showHeaders:true, \
columnTitles: ['Header 1', 'Header 2', 'Header 3', 'Header 4', 'Header 5', ]}\
}";
var myPalette = new Window(res); //Creates Window
/// Row 1 Contents
var myItem1 = myPalette.myListbox.add ('item', 'Cell 1-1');
myItem1.subItems[0].text = 'Cell 1-2';
myItem1.subItems[1].text = 'Cell 1-3';
/// Row 2 Contents
var myItem2 = myPalette.myListbox.add ('item', 'Cell 2-1');
myItem2.subItems[0].text = 'Cell 2-2';
myItem2.subItems[1].text = 'Cell 2-3';
/// Row 3 Contents
var myItem3 = myPalette.myListbox.add ('item', '');
myItem3.subItems[0].text = '';
myItem3.subItems[1].text = '';
myPalette.show(); //Shows final Window with contents
}
As for the Close button modify the "res" variable like so:
Code: Select all
var res = "dialog\
closeBut: Button{text: 'CLOSE'},\
myListbox: ListBox { alignment:['fill','fill'], properties:{\
multiselect:true, \
numberOfColumns:5, \
showHeaders:true, \
columnTitles: ['Header 1', 'Header 2', 'Header 3', 'Header 4', 'Header 5', ]}\
}";
Code: Select all
myPalette.closeBut.onClick=function(){myPalette.close();};
David Torno
https://vimeo.com/davidtorno (work samples & breakdowns)
https://gumroad.com/davidtorno
http://provideocoalition.com/dtorno (tutorials)
https://vimeo.com/davidtorno (work samples & breakdowns)
https://gumroad.com/davidtorno
http://provideocoalition.com/dtorno (tutorials)
-
- Posts: 39
- Joined: November 2nd, 2005, 10:20 am
- Contact:
Thanks David,
Your listbox worked like a charm but I still have a few issues.
Once the listbox is displayed, AE is "locked out" until I press escape which close the window.
To me, it seems like this is a different type of window than usual, the window I have with my "go" button is fine I can use AE perfectly until I hit go.
Also, the window with my go button has a close button by default and my list box doesn't.
And 3rd, I still cannot copy the data to the clipboard.
Here is my code.
Thanks again.
Phil
Your listbox worked like a charm but I still have a few issues.
Once the listbox is displayed, AE is "locked out" until I press escape which close the window.
To me, it seems like this is a different type of window than usual, the window I have with my "go" button is fine I can use AE perfectly until I hit go.
Also, the window with my go button has a close button by default and my list box doesn't.
And 3rd, I still cannot copy the data to the clipboard.
Here is my code.
Thanks again.
Phil
Code: Select all
var myPalette = buildUI(this);
if (myPalette != null && myPalette instanceof Window) {
myPalette.show()
}
function buildUI (thisObject) {
if (thisObject instanceof Panel) {
var myWindow = thisObject;
} else {
var myWindow = new Window ("palette", "Analyze");
}
myWindow.myPanel = myWindow.add("group");
myWindow.myPanel.orientation = "column";
myWindow.myPanel.okButton = myWindow.myPanel.add("button");
myWindow.myPanel.okButton.text = "Analyze Edit";
myWindow.layout.layout(true);
myWindow.layout.resize();
myWindow.myPanel.okButton.onClick = function () { // wait for the Anaylyze Button
ok_pressed();
}
return myWindow;
} //function buildUI ()
function ok_pressed(){ // main function
var myComp = app.project.activeItem;
var myLayers = myComp.selectedLayers;
if (myLayers.length < 1) {alert ("Select some layers");}
else {
var res = "dialog\
myListbox: ListBox { alignment:['fill','fill'], properties:{\
multiselect:true, \
numberOfColumns:5, \
showHeaders:true, \
closeButton:true,\
columnTitles: ['Layer Name', 'Source In', 'Source Out', 'Edit In', 'Edit Out', ]}\
}";
var listPalette = new Window(res); //Creates List Window
for (var i = 0; i <= myLayers.length -1 ; i++){ // loop through all layers
var layerName = myLayers[i].name;
var layer_in = myLayers[i].inPoint / myComp.frameDuration;
var layer_out = myLayers[i].outPoint / myComp.frameDuration;
var layer_time = myLayers[i].startTime / myComp.frameDuration ;
var source_name = layerName;
var source_in = Math.ceil(layer_in - layer_time);
var source_out = Math.ceil(layer_out - layer_time);
var myItem1 = listPalette.myListbox.add ('item', source_name); // fill out the list
myItem1.subItems[0].text = source_in;
myItem1.subItems[1].text = source_out;
myItem1.subItems[2].text = Math.ceil(layer_in);
myItem1.subItems[3].text = Math.ceil(layer_out);
} //end loop
listPalette.show(); //Shows final Window with contents
} // end functiobn
} // end if
Phil Spitler