Getting all the fields/buttons

Ken Ray kray at sonsothunder.com
Wed May 8 09:41:01 EDT 2002


Doug,

In Rev, all fields can be retrieved at once... there technically aren't any
"card fields" or "background fields" (although you can use those references
to retain older HyperCard/SuperCard scripting techniques). You can get all
the fields this way:

on listAllFields theStackName
  put empty into theFieldList  -- Note this is not necessary as all
first-used variables are empty by default
  repeat with i = 1 to the number of fields
    put (the long name of field i) &cr after theFieldList
  end repeat
  put theFieldList
end listAllFields

BTW: Unless you really need the names, I would recommend using "long id"
rather than "long name" - it is more accurate and less prone to confusion
(for example, if you have two fields named "Test", they would both have the
same long name).

Hope this helps,

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

----- Original Message -----
From: "Ivers, Doug E" <Doug_Ivers at lord.com>
To: <use-revolution at lists.runrev.com>
Sent: Wednesday, May 08, 2002 8:09 AM
Subject: Getting all the fields/buttons


> Is this the best way to "get" all the fields of a stack once and only
once?
> (Ultimately, I want to be able to change the font of all the fields in a
> stack, but for now this just lists them.)
>
>
> on listAllFields theStackName
>   put empty into theFieldList
>   -- bg fields
>   repeat with i = 1 to the number of backgrounds of stack theStackName
>     repeat with j = 1 to the number of fields of background i of stack
theStackName
>       get the long name of field j of background i of stack theStackName
>       put it&return after theFieldList
>     end repeat
>   end repeat
>   -- cd fields
>   repeat with i = 1 to the number of cards of stack theStackName
>     repeat with j = 1 to the number of fields of card i of stack
theStackName
>       get the owner of field j of card i of stack theStackName
>       if (word 1 of it is "group") then next repeat
>       get the long name of field j of card i of stack theStackName
>       put it&return after theFieldList
>     end repeat
>   end repeat
>   -- output
>   put theFieldList
> end listAllFields
> _______________________________________________
> 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