Page 1 of 1
Toggling hilite of list field line
Posted: Sun Mar 07, 2021 3:40 pm
by stam
Hi all,
sorry for the basic question, but i can't figure this one out :-/
I've set the "click to toggle" of a list field to true -- great, i can click to toggle the hilite and put the list field into a state where no lines are hilited.
However, what I'm looking for is a way to do this in script - is this possible?
apparently it's not possible to set the hilite of the selectedLine...
many thanks
Stam
Re: Toggling hilite of list field line
Posted: Sun Mar 07, 2021 3:50 pm
by Klaus
Hi Stam,
not sure, what exactly are you after?
But it surely will be scriptable!
Hint:
If you did not already, in LC preferences -> General
check -> Property labels are -> Name of Livecode property
Then you see the names of all properties in the inspector that you can use in scripts
and not just the description of that property.
Best
Klaus
Re: Toggling hilite of list field line
Posted: Sun Mar 07, 2021 3:57 pm
by stam
Klaus wrote: ↑Sun Mar 07, 2021 3:50 pm
not sure, what exactly are you after?
But it surely will be scriptable!
Hi Klaus
I'd like to put a listField in a state where no lines are hilited - this is not the default state and unless you set 'click to toggle' it's not possible
not to hilite some line or other.
The scenario where this is used is a listField with many options and a separate searchField; when the user types in the searchField it should find and select a line in the listField - however when no matches found, it should select none.
It's that last bit I can't figure out, hope that makes sense....
A simple example: A listField called "texts" and a search field called "search". A button with this script
Code: Select all
on mouseUp pButtonNumber
doFind the text of field "search"
end mouseUp
command doFind pText
find string pText in field "texts"
if the foundLine is not empty then
select the foundLine
else
//code to deselect the hilitedLine so no lines hilited
end if
end doFind
but can't find what i should put in the 'else' statement that would deselect the previously selected line
Re: Toggling hilite of list field line
Posted: Sun Mar 07, 2021 4:08 pm
by stam
I should also say i've tried examining all the properties of the list field as i often find things may not be obvious in the inspector panel. I ran this in the multiline messagebox:
Code: Select all
put the properties of field "texts" into myArray
combine myArray using return and ": "
put myArray
This shows a detailed listing of all the properties, but still couldn't see what i could use...
Grateful for any help!
Stam
Re: Toggling hilite of list field line
Posted: Sun Mar 07, 2021 4:09 pm
by Klaus
AHA!
Code: Select all
...
set the hilitedlines of fld "your listfield here" to EMPTY
...
Re: Toggling hilite of list field line
Posted: Sun Mar 07, 2021 4:10 pm
by stam
Perfect, thank you!!!
I was sure I tried that, but but have done something silly as this now works!