Use MenuPick properly

Peter Haworth pete at
Sat Feb 7 10:47:34 EST 2015

Hi Pascal,
After selecting the data from your db, do this

command createKeys pdata,pid
   --pdata is tab delimited data from revdatafromquery
   --   item 1 is the key, item 2 is the display data
   --pid is the long id of the menu button

   local tKeys,tText

   set the itemdelimiter to tab
   repeat for each line rLine in pdata
      put item 1 of rLine &return after tKeys
      put item 2 of rLine & return after tText
   end repeat
   set the text of pid to tText
   set the cKeys of pid to tKeys

end createKeys

on menuPick pitemname
   --use the menuHistory to access the cKeys cprop

   put pitemname into field xyx
   put line the menuHistory of me of the cKeys of me into field abc

end menuPick

lcSQL Software
On Feb 7, 2015 7:18 AM, "Pascal Lehner" <tate83 at> wrote:

> Hi all,
> I use menuPick to have a button with a drop down menu. The menu items are
> loaded from a database and the users selection needs to be stored back
> there too.
> the dropdown list looks as following (id, name)
> 1, full
> 2, half full
> 3, empty
> I save the users selection in two fields on the card
> item 1 in a hidden field ( to be stored in the database record)
> item 2 is displayed in another field
> obviously, the dropdown list does not look very nice like this. Even more
> so when I look at a real-world example with several words for "name"
> Can you think of a way to display only the "name" in the dropdown list, but
> still save the id in the hidden field?
> Thanks,
> Pascal
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:

More information about the use-livecode mailing list