Hi, this is my first post to AS Studio List - glad to be here. I am
loving AS Studio! Now on to my question.
I am building an AS Studio app that uses the XMLRPC method to query
my local MySQL database to, among other things, populate a few popup
buttons. The problem is that I can't figure out how to assign a
unique ID (key value) to the menu items in my Popup Button. For
example I want to....
Menu Item 1: DISPLAY "Company ABC" , USE "32433"
Menu Item 1: DISPLAY "Company QRS" , USE "26554"
Menu Item 1: DISPLAY "Company XYZ" , USE "55456"
I could, in theory use a list of records to check against once the
user makes a selection but that seems like a bad idea in case an
option, for whatever reason, has two items with the same name. Here
is what my code looks like, it works fine, except for inserting a
unique ID for each menu item.
-- fill the pop up menu
set the_window to theObject
set the_popup to popup button "the_vendors" of the_window
set id_product to contents of text field "id_product" of the_window
set the_params to {id_product:id_product}
-- delete the default popup item
delete every menu item of menu of the_popup
-- lasso/RPC.LassoAPP
tell application "http://tm-myserver.local/xml-rpc/
product_images.lasso"
set the_data to call xmlrpc {method
name:"fetch_product_vendors", parameters:the_params}
end tell
repeat with the_record in the_data
set the_vendor to the_vendor of the_record
set id_vendor to id_vendor of the_record
set the_menu_item to make new menu item at the end of menu
items of menu of the_popup with properties {title:the_vendor}
end repeat
As you can see I can successfully populate the popup button, but
where do I put/assign the ID value (id_vendor)? Is there another
property I can put in the menu item? I tried "id" and "name" but they
failed. I also tried assigning an associated object to the menu item
but I had no luck - most liekly I had the syntax wrong here as I
could find no explicit examples of setting and retrieving an assoc
object for a menu item.