How to get the x,y position of a word in a text field ?

dunbarx at aol.com dunbarx at aol.com
Thu Sep 19 08:35:40 EDT 2013


Hi.


Did not read your post fully. I see you already worked with the selectedLoc.



You mentioned that the user is free typing, and you want to validate words against a list of correct ones. I played around with this just for a second. In a field script:




on keydown var
   if var = space then
      put word the number of words of me of me && the selectedLoc of me
   end if
   pass keydown
end keydown


When the user types a space, the handler loads the last word typed as well as its loc. Can you use this as a starting point to get what you want? The handler can be modified to allow an internal word to be identified as well, should the user set the cursor in the middle of the text.


You can make a small field or some other gadget appear below the word in question, offering choices.


Craig Newman








-----Original Message-----
From: jbv <jbv at souslelogo.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Thu, Sep 19, 2013 3:00 am
Subject: How to get the x,y position of a word in a text field ?


Hi list,

I have a text field in which users can enter free text and I need
to detect typos in that text and display a list of possible
replacement words under the first word with a typo, this list being
left aligned with the left side of the word.

So far I use "find" followed by "the foundloc", or "select" followed
by "the selectedLoc" but it has to be done inside a "lock screen"
to avoid any display artefact, and it's a bit problematic when the
same  word with the same typo repeats twice in the text...
Is there a faster and less tricky way to do it ?

Thanks
jbv


_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list