Page 1 of 1
How to get the line of a field the user clicked on it
Posted: Sat Jun 17, 2017 5:29 pm
by RevigBreizh
Hi,
I have a field with many lines.
I would like to get the number of the line of this field, the user clicked on it. The field is read-only.
If the user clicks on the second line, I would like to get "2"…
Any help?
Thanks,
Rémi
Re: How to get the line of a field the user clicked on it
Posted: Sat Jun 17, 2017 5:45 pm
by bogs
I am guessing this is what you'd be looking for -
clickLine
Summary:
Returns the number of the line that the user last clicked in a field.
Examples:
select the clickLine
put the value of the clickLine into textOfClickedLine
Use the clickLine function within a mouseDown, mouseUp, or selectionChanged handler to determine which line the user clicked, in order to provide hypertext (clickable text) or take some action based on the click.
Value:
The clickLine function returns a chunk expression of the form line lineNumber of field fieldNumber.
Re: How to get the line of a field the user clicked on it
Posted: Sat Jun 17, 2017 5:52 pm
by RevigBreizh
Exactly what I wanted!
Thank you… I didn't find it into the Dictionary at first.
Re: How to get the line of a field the user clicked on it
Posted: Sat Jun 17, 2017 6:06 pm
by bogs
Yah, the dictionary can be a bit unwieldy to muck through. Generally what I find helps the most is to put, in this case, what your looking to get at.
So if you put 'line' in the search under all, it returns everything you can do with a line. You'll also find doing it that way that sometimes better options present themselves as well, as Lc has many ways to do similar things.
Glad I could help though

Re: How to get the line of a field the user clicked on it
Posted: Sat Jun 17, 2017 8:31 pm
by dunbarx
What bogs said.
In that vein, you might have, just for grins, taken at look at every native word that contains the string "char".
You would have found such things as the "clickChar" and the "mouseCharChunk". And others. It is often useful, and sometime revelatory, to see that one can go deeper than previously imagined. In other words, once you are a true LC fanatic, you will automatically think to yourself ; "If I can click on a word and get stuff back, why not a letter?".
And find that you can.
The dictionary does a good job of presenting related words. Most of us pride ourselves on our ability to use google, in that we are adept at presenting it with well thought out keywords to refine searches. Same with the dictionary.
Craig Newman
Re: How to get the line of a field the user clicked on it
Posted: Mon Jun 19, 2017 3:55 pm
by mrcoollion
For the great advice thank you.

- yoda.png (118.48 KiB) Viewed 6567 times
Re: How to get the line of a field the user clicked on it
Posted: Mon Jun 19, 2017 5:16 pm
by Klaus
I like yogurt better!

Re: How to get the line of a field the user clicked on it
Posted: Mon Jun 19, 2017 5:57 pm
by bogs
Ahh, Klaus is demonstrating the power of the Schwartz !