Getting a field name

Ken Ray kray at sonsothunder.com
Sun Apr 4 18:39:27 EDT 2004


Jim,

How about this (answers the clicked field, but "cancels" if the next object
clicked is not a field):

-- script of palette 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
  if gClickedField <> "***CANCEL***" then
    answer "The field clicked on was:" && gClickedField
  else
    -- something else was clicked on
    -- do what you want in this case 
  end if
end mouseUp

-- script of btn "clickTrapper"

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


HTH,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/


> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com 
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of 
> Jim Hurley
> Sent: Saturday, April 03, 2004 6:43 PM
> To: use-revolution at lists.runrev.com
> Subject: Getting a field name
> 
> 
> 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
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com 
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 




More information about the use-livecode mailing list