Skip to main content
This topic has been closed for replies.
Correct answer Peter Kahrel

That's a problem in Windows 10 with (I think) CS6. The fix is simple: instead of adding the listbox to the window, add a dummy group to the window and add the listbox to that dummy. Change the first three lines as follows:

var w = new Window ("dialog");

var dummy = w.add ("group")

var myList = dummy.add ("listbox", undefined, ["one", "two", "three"], {multiselect: true});

Note that you should set the multiselect property.

P.

1 reply

Anantha Prabu G
Legend
April 7, 2017

Hi,

Try this..

var w = new Window ("dialog");

var myList = w.add ("listbox", undefined, ["one", "two", "three"]);

var print = w.add ("button", undefined, "Print");

print.onClick = function ()

{

for (var i = 0; i < myList.items.length; i++)

$.writeln (myList.items.text);

}

w.show ();

Thanks

Design smarter, faster, and bolder with InDesign scripting.
Inspiring
April 7, 2017

I don't know why but i see empty list

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
April 8, 2017

That's a problem in Windows 10 with (I think) CS6. The fix is simple: instead of adding the listbox to the window, add a dummy group to the window and add the listbox to that dummy. Change the first three lines as follows:

var w = new Window ("dialog");

var dummy = w.add ("group")

var myList = dummy.add ("listbox", undefined, ["one", "two", "three"], {multiselect: true});

Note that you should set the multiselect property.

P.