Dialog.choices support for array vs vector?

According to the help file, Dialog.choices "uses either a Vector or an array of strings to provide a list of multiple options that can be shown to the user." The following sample code suggests that only vector works.

var dlg = DOpus.dlg;
dlg.buttons = "OK|Cancel";
dlg.title = "Which one?";
var a = "asdf\r\nqwerty\r\nzxcv".split(/\r\n/g);
dlg.choices = a;
dlg.message = "Pick one of " + a.length + " items..";
var res = dlg.show;
var v = DOpus.create.vector();
for (var i = 0; i < a.length; i++) v.push_back(a[i]);
dlg.choices = v;
dlg.message = "Pick one of " + v.count + " items..";
var res = dlg.show;

First dialog from dlg.choices = a (array)
Second dialog from dlg.choices = v (vector)

image

image

The vector dialog includes the three items but none are shown until the drop down arrow is pressed. I expected the first item to be presented in the selection field but maybe this is just the way Windows does drop down lists?

Opus can't access the contents of JScript arrays (this is why we added the Vector object in the first place). VBScript arrays are normal automation objects and will work.

The dropdown starts with no selection by default but you can set the selection property to select an item.