Getting a field name

Wouter wouter.abraham at pi.be
Sun Apr 4 09:11:17 EDT 2004


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

> Message: 9
> Date: Sun, 4 Apr 2004 12:33:31 +0200
> From: Klaus Major <klaus at major-k.de>
> Subject: Re: Getting a field name
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Message-ID: <84B0B80F-8623-11D8-815A-000A27B49A96 at major-k.de>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> Hi Jim,
>
>>> Here's my problem. A button handler in a palette stack reads:
>>>
>>> on mouseup
>>>   answer "Click on the application field." with OK
>>>   if it is empty then exit mouseUP
>>>   wait until the mouseclick
>>>   answer the clickstack --But I want the field name, not the stack
>>> name
>>> end mouseup
>>> ...
>> (Assuming the controls don't overlap.)
>>
>> There must be a cleaner way.
>
> Try:
>
> ...
> answer the mousecontrol
> ## ;-)
> ...
>
> and/or check "the mousecontrol" before asking.
>
> Hope that helps...
>
>> Jim
>
> Regards
>
> Klaus Major
> klaus at major-k.de
> www.major-k.de
>

Using it as suggested is not going to be reliable  as it will be empty 
most of the time.
(on my computer anyway)
Check it with this:

on mouseup
   answer "Click on the application field." with OK
   if it is empty then exit mouseUP
   wait until the mouseclick
   if the mousecontrol <> "" then answer the name of me &cr& the name of 
the mousecontrol
   else answer the name of me &cr& "mousecontrol is empty"
end mouseup

A working possibility is:

on mouseup
   if not the uCheckit of me and  not the hilite of me then
     answer "Click on the application field." with OK
     if it is empty then exit mouseUP
     set the ucheckit of me to true
     set the hilite of me to true
     checkforclickedfield
   else
### bug??? if commented out the hilite color stays on (Mac OS X 10.3.3)
     lock screen
     set the uCheckit of me to false
     set the hilite of me to false
   end if
end mouseup

on  checkForClickedField
   if the mouse is down then
     if the mousecontrol is not ""  and "field"&&quote is in the name of 
the mousecontrol then
         set the uCheckit of me to false
         set the hilite of me to false
         answer the name of the mousecontrol
     end if
   end if
   if the uCheckit of me  then send checkforclickedfield to me in 50 
millisecs
end checkForClickedField

But if the length of the script is a kludge then this is even a greater 
kludge :^)

Greetings,
WA



More information about the use-livecode mailing list