deleting multiple controls all at once

Dick Kriesel dick.kriesel at mail.com
Sun Feb 12 06:08:03 EST 2006


On 2/11/06 7:35 PM, "Josh Mellicker" <josh at dvcreators.net> wrote:

> Is there a way to delete a bunch of controls whose names match a
> wildcard expression like "thing.?" or "thing.??" all at once elegantly?
> 
> example:
> 
> thing.23
> thing.46
> thing.4
> thing.142
> 
> 
> delete all controls named "thing." & ?? doesn't work :-)
> 
> 
> Friends don't let friends do this:
> 
> REPEAT with n = 1 to 300
>              IF exists  ("thing." & n) THEN
>                  delete "thing." & n
>              END IF
>        END REPEAT
> 
> :P

If 300 isn't a meaningful number for your app, then you can do without it:

repeat with n = number of controls down to 1
  if char 1 to 6 of the short name of control n is "thing." then
    delete control n
  end if
end repeat

-- Dick





More information about the use-livecode mailing list