Need an example of how to use "try" and "catch"
Mark Wieder
mwieder at ahsoftware.net
Thu Mar 22 16:08:25 EDT 2012
> On Mar 22, 2012, at 10:33 AM, Michael Doub wrote:
>
> > Does anyone have any guidelines as to when you should use the try and catch
structure? I don't really know
> when or when not to use it.
Here's another use (and apropos a different thread here)
In order to recreate a control you'd want to
1. get the list of properties and their values
2. create a new control of the same type
3. set each of the properties to the original value
One problem with this is that some properties are read-only, and some can only
be applied to the parent object (can't set the rect of a card, for example).
So I do something like
repeat for each element tProp in tPropertyArray
try
set the tProp of tNewControl to tPropertyArray[tProp]
catch e
-- just ignore the error here
end try
end repeat
--
Mark Wieder
More information about the use-livecode
mailing list