Hi,
I would like to get the number of the cliked line in a field to change its backgroundcolor. So, I tried with the "mouseline" function and the "clickline", but it doesn't work...
Someone could help me, please ?
Thanks in advance,
Vincent.
Get a Number of line in Field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Get a Number of line in Field
Hello,
I used a trick to make it.
I lock the screen, then select the char (chunk) where the caret (cursor) is located. Finally I use "selectedLine" to check line number!
I used a trick to make it.
I lock the screen, then select the char (chunk) where the caret (cursor) is located. Finally I use "selectedLine" to check line number!
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki
http://runrevwidgets.com/wiki
Re: Get a Number of line in Field
How do you intend to change the color? Just by clicking on a line? If so, and if the field is locked:
If the field is not locked you need to decide how you want to handle the operation. You might use something like the trick suggested, to temporarily lock the field. Note also that holding the commandKey down while clicking will send a mouseUp message to the field, and you can use the handler above.
Code: Select all
on mouseup
put word 2 of the clickLine into tLine --you asked for the line number. not needed, though
set the foregroundColor of the clickline to any item of "red,green,blue,yellow"
end mouseup
Re: Get a Number of line in Field
In order to detect current line number, you can use this code:
Put it in the Field (your text editor). Time delay will prevent wrong line numbers, and will speed up cursor movements (update cursor position only if the user stop cursor movement).
Field "fldLine" is another field used to show current line number.
Code: Select all
local myRnd
on arrowKey
put random(100000) into myRnd
send "aggiorna" && myRnd to me in 100 milliseconds
pass arrowKey
end arrowKey
on aggiorna arg1
if arg1 is myRnd then
put the selectedLine into field "fldLine"
end if
end aggiorna
Field "fldLine" is another field used to show current line number.
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki
http://runrevwidgets.com/wiki