Page 1 of 1

multiLines Field

Posted: Mon Jul 21, 2014 11:56 pm
by robm80
In a multiline field 3 lines are selected. What's wrong with this script? No errormessages.

Code: Select all

repeat with i=1 to 19
if the selected of line i of fld "spec"is true then
put line i of fld "spec" into tVar
end if
end repeat
put tVar

Re: multiLines Field

Posted: Tue Jul 22, 2014 1:07 am
by Simon
Hi Rob,
The simple form is just to set the script of the field to

Code: Select all

on mouseUp
   put the selectedText
end mouseUp
If you did have a reason for the repeat just say.

Simon

Re: multiLines Field

Posted: Tue Jul 22, 2014 3:28 am
by dunbarx
Hi.

Are you sure you did not want the "hilitedLines" property? This gives all hilited lines in a list field. What do you think? Are hilited lines also selected?

Not that you cannot do this by script, but in your handler you do not collect the lines of interest in your construction. You do display them, but rather quickly. Do you see why? Step through the handler and watch. What is the last thing sent to msg?

Another hint. instead of running from 1 to 19 (unless you have a specific reason to do so) think about this:

Code: Select all

repeat with
i = 1 to the number of lines of fld "spec'"
Can you see (at least in general) that this is more robust than the original?

Craig Newman

Re: multiLines Field

Posted: Tue Jul 22, 2014 4:15 am
by robm80
Thank you both Craig & Simon,
Both answers give a result:

put the selectedText of fls "spec" answers with the written lines, f.i.
John
Walter
Jim

put the hilitedLines of fld "spec" answers with the numbers of the lines, f.i.
1,3,6

Both are very useful.
Rob