Page 1 of 1

add an item to an option box or list box

Posted: Mon Dec 02, 2013 11:43 am
by GPJMA
Hello all.
I am trying to allow a user to add an item (a location name for example) to a list already populated with some defaults. I want to be able to type the name into a text box and use a button to add it to the list box or option box contents.
Is this possible?
Cheers
Grahame

Re: add an item to an option box or list box

Posted: Mon Dec 02, 2013 1:49 pm
by Klaus
Hi Grahame,

sure it is :D

But for claritys sake please do not use non-Livecode termini like BOX, there is no BOX object in Livecode 8)
We have (text) FIELDS and OPTION MENUS (which are in fact buttons, but what the egg...)

What part is not clear to you:
1. Getting user input with ASK or getting the content of an existing field?
2. Appending a CR & the new entry to a FIELD or to -> the text of btn "your optionmenu"?
3. Both of them?

Best

Klaus

Re: add an item to an option box or list box

Posted: Mon Dec 02, 2013 3:29 pm
by FourthWorld
In addition to the fields and option controls Klaus mentioned, there's also a comboBox control, which allows user input. To capture that input and append it to the list you can trap the closeField message, get the label of the control, and then append it as Klaus showed with his Ask example.