Page 1 of 1

Scrolling List Field - code for each item

Posted: Thu Jan 31, 2013 5:52 am
by abanowBUSTfGf
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.

Re: Scrolling List Field - code for each item

Posted: Thu Jan 31, 2013 9:46 am
by jmburnod
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

Re: Scrolling List Field - code for each item

Posted: Thu Jan 31, 2013 1:43 pm
by Klaus
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