> 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




_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to