clear fields

Klaus Major klaus at major-k.de
Fri Jun 3 13:57:48 EDT 2005


Hi Bob,

> Hi All
>
> I have a script that clears the contents of fields in cards.
>
> on mouseUp
>   repeat with x = 1 to the number of flds
>    put empty into fld x
> end repeat
> end mouseUp
>
> Now this works ok except that the card has some labels and the  
> script clears
> the label contents.
>
> All the text fields are called field1, field2 etc
>
> so I thought of doing this
> on mouseUp
>   repeat with x = 1 to the number of flds
>     if the name of fld x is "field &*"
>   then put empty into fld x
> end repeat
> end mouseUp
>
> But I don't ge tthe fields clearing. I tried variations on the  
> "field & *"
> etc without any luck.

sorry, but "*", if used as a wildcard, only works with "filter" and  
regex...

> Any ideas

But you could use:

on mouseUp
   repeat with x = 1 to the number of flds
     if the short name of fld x CONTAINS "field" then
         put empty into fld x
     end if
   end repeat
end mouseUp

Hope that helps...

> Cheers
> Bob

Best

Klaus Major
klaus at major-k.de
http://www.major-k.de



More information about the use-livecode mailing list