Page 1 of 1
ComboBox to Field Script?
Posted: Thu Mar 27, 2014 8:13 pm
by rfulper
This may sound funny but I have little experience with scripting and in my LiveCode application I have a combo box where a user can select a number from 0 through 10. Once the selection is made, I would like that number to populate into a normal text field. Can anyone tell me how to achieve this?
Re: ComboBox to Field Script?
Posted: Thu Mar 27, 2014 9:09 pm
by Dixie
look at the script of your combobox..
Code: Select all
on menuPick pItemName
put pItemName into fld "whatevername"
switch pItemName
end switch
end menuPick
put 'put pItemName' ( which is the number you have selected) into fld "whatevername' (the fld where you want the number you have selected to be placed.)
Re: ComboBox to Field Script?
Posted: Thu Mar 27, 2014 10:06 pm
by dunbarx
Hi.
If you need the information upon selecting from the combo itself, do just what Dixie suggested. But know that with all such menu-style buttons (pull-down, option, etc) the menuHistory is a property, and can be obtained at any time from other sources:
answer the menuHistory of button yourMenuButton. --might yield "3", if the third line was chosen
In your case, the line chosen looks like it is also the contents of that line, or the "label". This "label" is also a property, and gives the text of the displayed line, but ONLY with comboBox and option styles. Pull-down and pop-up styles will return empty. I am not sure why. Anyway, you should experiment with these three methods of extracting information from these objects. Especially use the "switch" construction pre-set into the scripts. Dixie ignored this portion of code in his example, since it was not needed to answer your question.
Craig Newman