Getting a field name

Jim Hurley jhurley at infostations.com
Tue Apr 6 12:15:26 EDT 2004


Ken Ray,

The two scripts below are those you suggested as a method to solve my 
"get the field name" question.

Thanks you  for these. They are easy to follow, and worked well. (It 
only needed the "with messages" addition.)

Except for the first run after opening the file.

I find on that first run that the target (justToCheckItsValue below) 
turns out to be: button "Disclosure Triangle" whatever that is--I did 
click on a field and the target should have been a field.

  I imagine this "Disclosure Triangle" is some hidden RR button. Since 
it reports something not a field, the answer comes up "Not a field. 
Try again."

On all subsequent runs it works flawlessly. Any idea where that 
"Disclosure triangle" comes from or how to get rid of it?

Handler in Test button

on mouseUP
   global gClickedField
   put "" into gClickedField
   answer "Click on the application field."
   insert script of btn "clickTrapper" into front
   wait until gClickedField is not empty with messages
   if gClickedField <> "***CANCEL***" then
     answer "The field clicked on was:" && gClickedField
   else
     answer "Not a field. Try again." with "OK"
   end if
end mouseUp

Handler in "clickTrapper" button

on mouseUp
   global gClickedField
   put the target into justToCheckItsValue
   if word 1 of the target is "field" then
     put the short name of the target into gClickedField
     put gClickedField
   else
     put "***CANCEL***" into gClickedField
   end if
   remove script of me from front
end mouseUp

I tried putting in a "put the target into throwMeAway" after the 
first mouseUp just to see if I might "purge" the target function, but 
to no avail.

  Jim


More information about the use-livecode mailing list