Retrieving data from a combo box

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

hsh_636
Posts: 31
Joined: Sun Mar 02, 2014 5:15 pm

Retrieving data from a combo box

Post by hsh_636 » Thu May 15, 2014 3:47 pm

Hello, Im new to using combo boxes I already figured out how to populate it with data from mysql database. However, but how can I determine or retrieve the selected option on the combo box, thanks.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Retrieving data from a combo box

Post by Klaus » Thu May 15, 2014 4:29 pm

Hi hsh_636,

you are looking for:
...
put the label of btn "your combo box here..." into tCurrentSelection
...
:D


Best

Klaus

hsh_636
Posts: 31
Joined: Sun Mar 02, 2014 5:15 pm

Re: Retrieving data from a combo box

Post by hsh_636 » Thu May 15, 2014 4:39 pm

Thanks for your reply the thing is I did exactly what you told me to do but when I retrieve it and insert it into my table nothing is inserted which means nothing is retrieved does the field type of the column (int) of the table Im inserting it to have anything to do with it?

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Retrieving data from a combo box

Post by Klaus » Thu May 15, 2014 4:50 pm

Hm, int = integer, right? That will surely not work if your label is a STRING! 8)

hsh_636
Posts: 31
Joined: Sun Mar 02, 2014 5:15 pm

Re: Retrieving data from a combo box

Post by hsh_636 » Thu May 15, 2014 5:11 pm

The combobox retrieved the value from the database and in the database its a number (integer), so the value for the combobox label is a number which means its in fact an integer, is there a command that will retrieve the value chosen because Im not sure how the label command work.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Retrieving data from a combo box

Post by Klaus » Thu May 15, 2014 5:22 pm

Well, then it should work! :D

Hint:
There is no "label command" in Livecode! 8)
But you can simply retrieve this "property" like in my example.

So if it does not work for you then the error must be somewhere else!
I need more info/scripts etc. to be more helpful.

hsh_636
Posts: 31
Joined: Sun Mar 02, 2014 5:15 pm

Re: Retrieving data from a combo box

Post by hsh_636 » Thu May 15, 2014 5:26 pm

Thanks Klaus for all your help.

hsh_636
Posts: 31
Joined: Sun Mar 02, 2014 5:15 pm

Re: Retrieving data from a combo box

Post by hsh_636 » Thu May 15, 2014 5:50 pm

Solved it!!! the problem was in other piece of the code!!!

hsh_636
Posts: 31
Joined: Sun Mar 02, 2014 5:15 pm

Re: Retrieving data from a combo box

Post by hsh_636 » Mon May 26, 2014 2:14 pm

Hello, everybody I have a similar question similar to the combobox one I already finished retrieving data from the combobox and I was thinking can I do the same thing for the scrolling list field I mean how can I retrieve the data selected in the scrolling list field and if its possible to begin with.
Thanks, in advance.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Retrieving data from a combo box

Post by Klaus » Mon May 26, 2014 2:41 pm

Hi,

you want to:
...
put the selectedtext of fld "your listfield here..." into tUserSelection
...


Best

Klaus

hsh_636
Posts: 31
Joined: Sun Mar 02, 2014 5:15 pm

Re: Retrieving data from a combo box

Post by hsh_636 » Mon May 26, 2014 3:24 pm

Thanks for all the help again.

hsh_636
Posts: 31
Joined: Sun Mar 02, 2014 5:15 pm

Re: Retrieving data from a combo box

Post by hsh_636 » Mon May 26, 2014 10:42 pm

I have one more question about the scrolling list field is it possible to activate an action once the user clicks on a choice in the scrolling list field and if so how?,
Thanks appreciate all the help.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Retrieving data from a combo box

Post by Simon » Tue May 27, 2014 1:10 am

Here you go hsh_636,

Code: Select all

on mouseUp
   put the selectedText
end mouseUp
Make sense?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

hsh_636
Posts: 31
Joined: Sun Mar 02, 2014 5:15 pm

Re: Retrieving data from a combo box

Post by hsh_636 » Tue May 27, 2014 9:58 am

What I meant by an action I meant for example going to another card, the code that you gave me only put the selected choice into a variable I want a way that allow the user that once he/she clicks on a choice the user goes to another card.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Retrieving data from a combo box

Post by Klaus » Tue May 27, 2014 11:32 am

Hi hsh_636,
hsh_636 wrote:...the code that you gave me only put the selected choice into a variable I want a way that allow the user that once he/she clicks on a choice the user goes to another card.
maybe replacing
...
put the selectedtext of me into tVar
...
In the mouseup handler with
...
go cd "whatever"
...
will do what you want?
8)


Best

Klaus

Post Reply

Return to “Talking LiveCode”