Article View: adobe.scripting.indesign
Article #2306Re: [CS3, JS] Stuck on DropDownList again
From: Peter Kahrel
Date: Tue, 23 Dec 2008 09:44
Date: Tue, 23 Dec 2008 09:44
55 lines
1906 bytes
1906 bytes
Eric,
stringList is a property in the 'classic' dialog model, not in scriptUI. There's a creation problem with dropdowns in scriptUI in that the property name to use is "items", which throws an error:
l: DropDownList { \
items: ['A-Master', 'B-Master'], \
preferredSize: [200, 20] }, \
So you'd have to use something like this:
l: DropDownList { \
{properties: {items: ['A-Master', 'B-Master']}, \
preferredSize: [200, 20] }, \
To show some item after the window has been created, do this:
w = new Window (res);
w.master.l.selection = 1;
w.show()
This is one of the reasons why I think that resource strings are a pain. The reason cited most often for using resource strings is that they allow you to separate design features from code. But this separation is also possible without using resoource strings. And ironically, you used code in your res. string. I'd think that the purist would do something like this:
...
...
l: DropDownList {preferredSize: [200, 20]}, \
...
...
w = new Window (res);
w.master.l.add ('item', 'A-Master');
w.master.l.add ('item', 'B-Master');
w.master.l.selection = 1;
w.show()
After all, the contents of the array is not part of the design.
Peter
Technical Details
Message-ID:
<59b75633.0@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2!feeder.erje.net!news4us.nl!webcrossingReferences:
<59b75633.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,1e62effa5417a1dc X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Peter Kahrel" <kahrel@kahrel.plus.com> Newsgroups: adobe.scripting.indesign Subject: Re: [CS3, JS] Stuck on DropDownList again Message-ID: <59b75633.0@webcrossing.la2eafNXanI> Date: Tue, 23 Dec 2008 01:44:30 -0800 References: <59b75633.-1@webcrossing.la2eafNXanI> Lines: 44 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2!feeder.erje.net!news4us.nl!webcrossing