Determining exact location within a field

Scott Rossi scott at tactilemedia.com
Thu Feb 26 14:33:37 EST 2004


> Does anyone know of a way to find the location of a specific spot
> within a text field? I am interested in developing a module that will
> allow me to construct a fill-in-the-blank activity. My thought is to
> construct a text in a field and mark the words that I want to replace
> in some way (precede them with a special character). Then I want to
> construct a button with a script that finds the words with this
> character in the text and replaces them with a space. Over this space
> I want to create a field into which users can enter the missing word.
> It would be nice to automate this process and to be able to know
> exactly where to place the new field, how large to make it, etc. But I
> cannot figure out the placement issue.

I believe the foundLoc function is one way to do it.  Use the textHeight of
the target field to calculate the height of the "text box", and apply the
foundLoc to the last char of the target word to determine the width of the
"text box".

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the use-livecode mailing list