Page 1 of 1
List field selected item
Posted: Mon Oct 21, 2013 9:59 pm
by appmann
Hi
How do i use the text on the selectedline in a list? I want to put it into a variable and then use it to find cards with the same name, delete cards and even delete the selected line.
I tryed with this:
put the hilitedline of fld "ProfilesList" into cDelete
delete the hilitedline of fld "ProfilesList"
delete card cDelete of stack "ProfilesSub"
It worked almost. But i cant delete the lines from list. and I dont know why, but i created a card Named whee and i cant delete this one again. It worked with the others.
Re: List field selected item
Posted: Mon Oct 21, 2013 10:19 pm
by LCNeil
Hi appman,
The hilitedLine will return a numerical value of the line that is currently selected in your field. If you want the value that is associated with that line, be able to delete a line in field and/or a specified card you will have to use something like-
Code: Select all
put the hilitedline of fld "ProfilesList" into tLine
put line tLine of field "profilesList" into cDelete
delete line tLine of field "profileList"
delete card cDelete of stack "profileSub"
I hope this gives you some leads
Kind Regards,
Neil Roger
--
RunRev Support Team ~
http://www.runrev.com
--
Re: List field selected item
Posted: Tue Oct 22, 2013 6:35 am
by Dixie
appman...
I have attached a stack that might help you... it uses a list field, of course..

Option-Click on a line in the field and a popUp menu will appear allowing you to make some choices, to delete a line, delete a card or go to a card... have a look at the scripts
Re: List field selected item
Posted: Tue Oct 22, 2013 8:30 am
by appmann
THX to you both.
That make sence. I just needed to know that lists only look at line number, and not values.
Problem solved
Re: List field selected item
Posted: Tue Oct 22, 2013 11:15 am
by Klaus
Hi appman,
you should take the time to check these stacks to understand more of the basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html
Try to understand what you are doing, not only the correct use of the syntax, but also the meaning of it!
Here a little exemple from your script:
1. put the hilitedline of fld "ProfilesList" into cDelete
What does cDelete contain after this line? Do you know without checking?
It will contains NUMBER or 0 (ZERO), if no line is selected -> the number of the currently selected line!
2. delete the hilitedline of fld "ProfilesList"
So this line will translate to something like:
delete 2
?? Well, no wonder that nothing does happen...
3. delete card cDelete of stack "ProfilesSub"
This line however will work, as long there is a card 2 of that stack.
As you see, everything is logical as can be
Add some "answer xyz" to your script, seeing is believing!
Best
Klaus
Re: List field selected item
Posted: Tue Oct 22, 2013 1:56 pm
by appmann
Hi Klaus.
You are the best.
I have tryed to look around the Inet for som sample scripts. Im used to code Visual basic, and it took some time to see the logic in that too.
I have finished the LCU and got the app-academy too.
My problem is: From LCU to App-Academy, there is 10.000 miles in difference.
And. in LC there is a lot of ways to do stuff. im used to only one right way (or two).
Then when im using LiveCode, im combining 3 different ways to do things in one single code, from what i think is logical.
Its also a problem to google for ways to do stuff. Bechause u have to use the right search words to find good examples. fx "Put" instead of "Insert" or "paste".
And then im looking at the livecode lessons. But after what u say, its not straight after the line?
Thats why i have some problems starting up on this.
But i know from Visual Basic codeing.
When i see the logic and get to know the most basic scripting, then im in the right track.
It will be easyer to find examples on web, and find the right one. And also convert it to whatever i want.
and also ask for the right info inhere.
and finally. the basic is most important. the most common used objects and scripts. and then there will not be anythink to ask. Then its me to answar.
But thx Klaus.