Scrolling List Field - code for each item

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

Post Reply
abanowBUSTfGf
Posts: 63
Joined: Sat Dec 22, 2012 3:01 am

Scrolling List Field - code for each item

Post by abanowBUSTfGf » Thu Jan 31, 2013 5:52 am

I have a simple scrolling field list of 10 lines of text.
I want to display something on the right hand side of the card when each item
on the list is selected e.g. when line 1 of the scrolling field list is selected, display "this is the first line of text"
when the line 2 of the scrolling field list is selected display "You have selected the second line in the list" etc.

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

Re: Scrolling List Field - code for each item

Post by jmburnod » Thu Jan 31, 2013 9:46 am

Hi abanowBUSTfGf,

The hilitedlines should be the trick.

Code: Select all

on DoCommentList
   put the hilitedlines of field "myField" into tLineHi
   if tLineHi = empty then exit DoCommentList
   put empty into tCommentLine
   repeat for each item tNoLine in tLineHi
      put line tNoLine of field "fCommentLine" & cr after tCommentLine -- a field with one comment per line
   end repeat
   delete char -1 of tCommentLine
   put tCommentLine
end DoCommentList
Best regards
Jean-Marc
https://alternatic.ch

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

Re: Scrolling List Field - code for each item

Post by Klaus » Thu Jan 31, 2013 1:43 pm

Hi abanowBUSTfGf,

you really should get the basics of Livecode as explained in the Scripting Conferences!
I think I mentioned this before 8)

Put this into the script of the listfield:

Code: Select all

on mouseup
  put the hilitedlines of me into tHL
  put "You selected line:" && tHL & "!" into fld "the other field"
end mouseup
Look up "hilitedlines" in the dictionary!
And maybe stack "Controls" from the "Scripting Conferences"! :D


Best

Klaus

Post Reply