It can't be done directly with AppleScript, but is done very easily
with the following "call method" lines (theList is obviously just a
variable holding the list of items you want in the popup menu)
set thePopButton to popup button "..." of window "..."
call method "removeAllItems" of thePopButton
call method "addItemsWithTitles:" of thePopButton with parameter
theList
As for the list view box, I would recommend using a table view and data
source. It's perhaps a little tricky to get the hang of immediately,
but is very powerful once you have. There is an example called "Table"
amongst the AppleScript Studio Examples. It has two scripts, one
"WithoutDataSource" and one "WithDataSource". With data source is the
way to go.
Philip
On 11 Mar 2005, at 15:23, Jim Trebilcock wrote:
I'm porting my old FaceSpan apps (FaceSpan is a GUI-maker) to AS
Studio. This is going well, but I miss a view FS conventions.
For one thing, it was easy to dynamically populate a popup
button using a "set contents of popup 'foo' to 'whatever'." Also, FS
offered a "list view" box. Items entered into the box did not need to
be coerced from string to list. Any string followed by a return was
treated as a single list item - making it super easy to add full names
to a list.
Here's what I'm trying to achieve. I have a "Send Wire" app that
makes it simple to send stories to the Associated Press news wires (I
work for a newspaper). In the main window, I have a "Staff" popup with
the names of our staff writers. In the Preferences window for Send
Wire, I have a list box that allows for easy addition and subtraction
to the Staff popup. (Reporters have a tendency to come and go.)
I'm stumped as to how to achieve the same in AS Studio.
Dynamically dding items to an AS Studio popup is a pain. AFAIK, I have
to "make" each popup item. Also, I'm unsure what to use in place of
the FS list box for the Preferences staff additions and deletions. AS
Studio text view items don't coerce well from string to list (each
letter is coerced as an individual list item).
Does anyone have any suggestions? Is there a way to "set
contents of popup button "foo" ? And is there a "list view" component
to AS Studio of which I'm unaware? (Is the browser view what I'm
looking for? I'll examine that now.)
Thanks for any and all advice.
Jim