Getting a field name
Jim Hurley
jhurley at infostations.com
Sat Apr 3 21:06:49 EST 2004
>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
>
>What the user is suppose to do is click on the field in the
>application stack and the name of the field is revealed. The above
>handler produces the stack name, not the field name.
>
>Naturally I tried "the clickField" but that comes up empty.
>(clickField is set to empty after a mouseclick.) And "the target"
>gives the name of the button which originally received the message
>in the palette stack, not the field in the application stack.
>
>How do I get the name of the clicked field in the application
>stack revealed to the palette stack?
>
>Jim
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.
Jim
More information about the use-livecode
mailing list