Page 1 of 1

A curiosity with 'the clickline'...

Posted: Mon May 23, 2016 10:52 pm
by Fermin
Scripts in a field (with lockText, of course)
It works or not, according to the order of the lines.

Code: Select all

on mouseup
   answer the clickline -- it works
   set the textstyle of me to plain 
end mouseup
------------------------
on mouseup
   set the textstyle of me to plain
   answer the clickline -- it does not work
end mouseup

Re: A curiosity with 'the clickline'...

Posted: Tue May 24, 2016 8:42 am
by bn
Hi Fermin,

the dictionary says:
The clickLine function is cleared at the next mouse click, as well as after some editing actions such as deleting text. If the last click was not in a field, the clickLine function returns empty.
setting the textStyle of a field is apparently one of the editing actions. You force a rebuild of the field.

Kind regards
Bernd

Re: A curiosity with 'the clickline'...

Posted: Tue May 24, 2016 12:51 pm
by Fermin
You're right, I should have read carefully the dictionary. Thank you very much, Bernd.

Re: A curiosity with 'the clickline'...

Posted: Tue May 24, 2016 2:49 pm
by dunbarx
What Bernd said.

This is why one should ALWAYS put the results of these functions, as well as anything that loads the local variable "it", into another variable RIGHT AWAY.

And this is coming from someone who is sloppy in that regard, and has to go back now and then and fix stuff instead of doing it right the first time.

Craig Newman