cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Andyon98
Level II

How do you append a list onto a col list box?

The syntax is causing me confusion, I tried something similar as below. However it does not work.

colbox << append(dt << mylist);
4 REPLIES 4
txnelson
Super User

Re: How do you append a list onto a col list box?

Here is an example I took from the Scripting Index with a little modification to show you what you want

Names Default To Here( 1 );
New Window( "Example",
	fontobj = lb = List Box({},
		width( 200 ),
		max selected( 2 ),
		nlines( 6 )
	)
);

theList = {"First Item", "Second Item", "Third Item"};
lb << Append( theList );
Jim
Andyon98
Level II

Re: How do you append a list onto a col list box?

That works correctly - in my application I have a list of lists but it wont work for some reason. See your code below slightly edited.

Names Default To Here( 1 );
New Window( "Example",
	fontobj = lb = List Box({},
		width( 200 ),
		max selected( 2 ),
		nlines( 6 )
	)
);

theList = {{"First Item", "Second Item", "Third Item"},{"Fourth Item", "Fifth Item", "Sixth Item"}};

//Im trying to pull the second list from the list of lists for(i=1, i=3, i++, lb << Append( theList[2][i] ); );

 

txnelson
Super User

Re: How do you append a list onto a col list box?

Your For Loop is in error.  It should be

for(i=1, i<=3, i++, 
lb << Append( theList[2][i] );
);
Jim
ErraticAttack
Level VI

Re: How do you append a list onto a col list box?

No need to loop:

Names Default To Here( 1 );
New Window( "Example",
	fontobj = lb = List Box({},
		width( 200 ),
		max selected( 2 ),
		nlines( 6 )
	)
);

theList = {{"First Item", "Second Item", "Third Item"},{"Fourth Item", "Fifth Item", "Sixth Item"}};
//Im trying to pull the second list from the list of lists
lb << Append( theList[2] );
Jordan