What is the script for selecting a specific word in a field?

Robert Ball reball at mac.com
Wed May 18 11:44:23 EDT 2005


Hello Eric from Paris, thank you so much for responding to my request 
for help. Apparently I did not make clear exactly what I want to do in 
my first message, so here is my second attempt.

I have a field YourAnswer on a card with several instances of xxx. I 
want to press the tab key and have the cursor move to the next instance 
of xxx and also hilite the xxx. The script

on tabKey
   find word xxx in field "YourAnswer"
end tabKey

moves the cursor to the next xxx and draws an outline box around the 
xxx, but it doesn't hilite the xxx, which is what I want. I have to 
double click the found xxx to select it.

I had hoped the script

on tabKey
   select word xxx in field "YourAnswer"
end tabKey

would work, but it doesn't. I must be doing something wrong.

Robert

PS -- this is my first message, I just joined the list yesterday. I 
hope this is how to respond to your message.




Hi Robert,

As usual, it is very interesting to think of "Is there such a script
which do that in the IDE?"
Lights!
In any script window, the Find button does what I want ;-)

So, check the revFindNext function in the script of the single card
of any script window which is called by the Find button and adapt it.
In order to open scripts in IDE windows, check the "Contextual menus
work in Revolution windows" in the main pane of the Rev Prefs.
Then use a right click to display the contextual menu in any IDE window.
Exploring the IDE always gets you rich...

Best regards from Paris,

Eric Chatonet.

Le 17 mai 05 à 23:05, Robert Ball a écrit :

 > I have a field YourAnswer with several instances of xxx. I want to
 > tab to each instance of xxx. The scripts
 >
 > on tabKey
 >   find word xxx in field "YourAnswer"
 > end tabKey
 >
 > and
 >
 > on tabKey
 >   find "xxx" in field "YourAnswer"
 > end tabKey
 >
 > work, but they give me an outline box around xxx, which is not the
 > same thing as selecting xxx, which hilites xxx.
 >
 > The analogous script
 >
 > on tabKey
 >   select word xxx in field "YourAnswer"
 > end tabKey
 >
 > does not work. Neither do
 >
 > on tabKey
 >   select word xxx of field "YourAnswer"
 > end tabKey
 >
 > or
 >
 > on tabKey
 >   select "xxx" of field "YourAnswer"
 > end tabKey
 >

----------------------------------------------------------------


More information about the use-livecode mailing list