Check if List Field selected?

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
appmann
Posts: 33
Joined: Wed Oct 09, 2013 9:08 pm

Check if List Field selected?

Post by appmann » Fri Oct 25, 2013 8:43 pm

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?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Check if List Field selected?

Post by dunbarx » Fri Oct 25, 2013 9:01 pm

Hi,

Close.

The "hilitedLines". See the dictionary.

Craig newman

tjm167us
Posts: 50
Joined: Sat Dec 03, 2011 8:27 pm

Re: Check if List Field selected?

Post by tjm167us » Sat Oct 26, 2013 9:04 pm

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

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

Re: Check if List Field selected?

Post by Klaus » Sun Oct 27, 2013 1:29 pm

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

Post Reply