Page 1 of 1

UI woes: multi-column listbox

Posted: November 11th, 2010, 11:44 am
by berniebernie
Hello coders. I feel like I'm alone here.

I'm trying to use a listbox with column titles, as mentioned in the javascript tools guide. However I get a nasty (and seldom seen) error message upon executing the code:

Code: Select all

Server interface error ''
the code i'm using is

Code: Select all

var list = pal.add ("ListBox", [10, 50, 260,320], "desc",{numberOfColumns: 2,showHeaders: true,columnTitles: ['Shot', 'Status']});        

Re: UI woes: multi-column listbox

Posted: February 1st, 2011, 5:48 pm
by vfxman
If I add a new window via this code, it shows up fine.

Code: Select all

//"undefined" would be the window size. undefined=auto size and [0,0,200,300] would be specific pixel size 200 width x 300 height;
var pal = new Window("palette", "LIST", undefined);
var list = pal.add ("ListBox", [10, 50, 260,320], "desc",{numberOfColumns: 2,showHeaders: true,columnTitles: ['Shot', 'Status']});
pal.center()
pal.show();
Image

Re: UI woes: multi-column listbox

Posted: March 16th, 2011, 12:01 pm
by philspitler
Hi David,
Your code works in Extended Script but gives me and error when I try and run it in AE.

I just posted a question with some other ListBox issues too,

Phil

Re: UI woes: multi-column listbox

Posted: March 16th, 2011, 4:25 pm
by vfxman
philspitler wrote:Your code works in Extended Script but gives me and error when I try and run it in AE.
I ran into the same thing last weekend. I had forgotten about this post, thanks for the reminder. Here is what I found worked in AE for me.

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
}