Put item from “scrolling list field” into variable? - Solved

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Put item from “scrolling list field” into variable? - Solved

Post by DR White » Wed Jan 22, 2014 11:37 am

How do I select an item from “scrolling list field” and put it into a variable?

Thanks,

David
Last edited by DR White on Wed Jan 22, 2014 2:24 pm, edited 1 time in total.

ChrisMukrow
Posts: 73
Joined: Mon Nov 12, 2012 4:13 pm

Re: Put item from “scrolling list field” into variable?

Post by ChrisMukrow » Wed Jan 22, 2014 12:59 pm

Code: Select all

put line 1 of field "yourfieldname" into yourvariablename
Chris
Last edited by ChrisMukrow on Wed Jan 22, 2014 1:01 pm, edited 1 time in total.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Put item from “scrolling list field” into variable?

Post by jmburnod » Wed Jan 22, 2014 12:59 pm

Hi David,

If I understand correctly what you want I think "hilitedlines" is the magic word for you.

Best regards
Jean-Marc
https://alternatic.ch

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Put item from “scrolling list field” into variable?

Post by DR White » Wed Jan 22, 2014 2:23 pm

Jean-Marc and Chris,

With each of your help the following code works well:

put hilitedline of field "MotorList" into test1
put line test1 of field "MotorList" into tListItem

Thanks, :D

David

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Put item from “scrolling list field” into variable? - So

Post by MaxV » Wed Jan 22, 2014 2:26 pm

I always used:

Code: Select all

the selectedtext of me
What is the correct one?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Put item from “scrolling list field” into variable? - So

Post by jmburnod » Wed Jan 22, 2014 2:43 pm

Hi MaxV,

I use rather hilitedlines because the hilitedlines is a best way to store it

Best

Jean-Marc
https://alternatic.ch

Klaus
Posts: 14205
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Put item from “scrolling list field” into variable? - So

Post by Klaus » Wed Jan 22, 2014 2:44 pm

Hi Max,

both "hilitedline..." and "the selected text of me" are valid and do the job :D
The difference is that the latter needs less typing.


Best

Klaus

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

Re: Put item from “scrolling list field” into variable? - So

Post by robm80 » Wed May 07, 2014 9:40 am

This is my script to go to a card. In the scrolling list field there is hilited line "foo".

on mouseUp
get line (the hilitedLines of field "myfield") of field "myfield"
put it into whatcard //so far OK
go to card whatcard //does nothing
end mouseUp

please help
Rob

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

Re: Put item from “scrolling list field” into variable? - So

Post by Simon » Wed May 07, 2014 9:52 am

Hi Rob,
In the field script this works:

Code: Select all

on mouseUp
put the selectedText of me into whatCard
go to card whatcard
end mouseUp
Only the name of the card should be in the field.

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

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

Re: Put item from “scrolling list field” into variable? - So

Post by robm80 » Wed May 07, 2014 12:01 pm

Simon,
Your script:
on mouseUp
put the selectedText of me into whatCard
go to card whatcard
end mouseUp
Compare it with my script:
on mouseUp
get line (the hilitedLines of field "myfield") of field "myfield"
put it into whatcard //so far OK
go to card whatcard //does nothing
end mouseUp
Both scripts do not work.
Why not?

here a part of my scrolling field list:
sshot-7.jpg
sshot-7.jpg (10.48 KiB) Viewed 8575 times

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

Re: Put item from “scrolling list field” into variable? - So

Post by Simon » Wed May 07, 2014 12:05 pm

Hi Rob,
Why not?
errr... I'm not actually clairvoyant, Klaus is.

Can you post your stack?

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

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

Re: Put item from “scrolling list field” into variable? - So

Post by robm80 » Wed May 07, 2014 12:22 pm

Can you post your stack?
How do I post a stack ??
It is not accepted as attachment.
If I can get an emailaddress, I can send it.

Klaus
Posts: 14205
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Put item from “scrolling list field” into variable? - So

Post by Klaus » Wed May 07, 2014 12:25 pm

Hi Rob,

I think you need at least 10 posting before you can post attachments.
I can offer to take a look at your stack, send it to:
klaus AT major-k.de


Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Put item from “scrolling list field” into variable? - So

Post by jacque » Wed May 07, 2014 4:26 pm

When a "go" command fails the reason is placed into the result, so you can check that to see what went wrong.

Code: Select all

go to card whatcard
put the result 
The error will be in the message box.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Klaus
Posts: 14205
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Put item from “scrolling list field” into variable? - So

Post by Klaus » Wed May 07, 2014 4:46 pm

Hi friends,

we have solved the puzzle!
There were some strange invsible characters at the end of the lines in the field.

If it would be that easy every time... 8)


Best

Klaus

Post Reply