Page 1 of 1

Check if List Field selected?

Posted: Fri Oct 25, 2013 8:43 pm
by appmann
Hi.

I have tryed a lot, and looked on LC-lessons about fields and more.

I have a list Field.
I want a script to run IF a line are selected in the field.

What is the "syntax" to look at?
I have tryed:
If selected.
If hilitedline
if hilited
Maby its something like Visual Basic with the GotFocus command?

Re: Check if List Field selected?

Posted: Fri Oct 25, 2013 9:01 pm
by dunbarx
Hi,

Close.

The "hilitedLines". See the dictionary.

Craig newman

Re: Check if List Field selected?

Posted: Sat Oct 26, 2013 9:04 pm
by tjm167us
Please note that hilitedLines will tell you the line number of the line selected, but not give you the contents of the line. To do that, you need to use the selectedText function or a chunk expression like (assuming your code is within the list Field script:

Code: Select all

answer line (the hilitedLines of me) of me
.

Additionally, checking whether the hilitedLines of a list field is empty is how you would determine whether or not to take action like you are asking. So, in the mouseUp handler within your list field script:

Code: Select all

on mouseUp
if the hilitedLines of me is not empty then
--put your code here
end if
end mouseUp
Tom

Re: Check if List Field selected?

Posted: Sun Oct 27, 2013 1:29 pm
by Klaus
Hi appman,

please check these stacks to ge the basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html

Maybe you should start with stack "Controls" :D


Best

Klaus