Getting a field name

Wouter wouter.abraham at pi.be
Sun Apr 4 05:12:42 EDT 2004


On 04 Apr 2004, at 07:15, use-revolution-request at lists.runrev.com wrote:

> Message: 5
> Date: Sat, 3 Apr 2004 18:06:49 -0800
> From: Jim Hurley <jhurley at infostations.com>
> Subject: Re: Getting a field name
> To: use-revolution at lists.runrev.com
> Message-ID: <a05100300bc9518b63203@[66.81.140.252]>
> Content-Type: text/plain; charset="us-ascii" ; format="flowed"
>
>

snip

> Well, I found a way, but it is a kludge:
>
> on mouseup
>    answer "Click on the field to use." with OK
>    wait until the mouseclick
>    put the clickloc into tLoc
>    put the clickstack into tStackName
>    repeat with i = 1 to the number of controls in tStackName
>      if tloc is within the rect of control i of  tStackName then
>        put the  name of control i of tStackName into theClickControl
>        exit repeat
>      end if
>    end repeat
>    put theClickControl into field theFieldName
> end mouseup
>
>
> (Assuming the controls don't overlap.)
>
> There must be a cleaner way.
>


Your idea  is not really a kludge. But instead of :

>    repeat with i = 1 to the number of controls in tStackName

you can:

  on mouseup
   answer "Click on the application field." with OK
   if it is empty then exit mouseUP
   --set the hilite of me to true
   put "" into tAnswer
   wait until the mouseclick
   repeat with i = 1 to the number of flds on this cd
     if the mouseloc is within the rect of field i then put the long 
name of fld i into tAnswer
   end repeat
   if tAnswer is "" then put "no field clicked" into tAnswer
   --set the hilite of me to false
   answer tAnswer
end mouseup

To be able to use the target or the mousecontrol, you have to do it 
differently.

Greetings,
WA



More information about the use-livecode mailing list