Sequential Layout of Script-created Objects
Richard Gaskin
ambassador at fourthworld.com
Sun Dec 8 17:24:01 EST 2002
Bernard Devlin wrote:
> This is the code that loops through the controls and (conditionally) deletes
> them:
>
> repeat with x = 1 to the number of controls of group "grpButtons" of stack
> "Map"
> put the name of control x of group "grpButtons" of stack "Map" into
> theControl
> if word 1 of theControl is "button" then
> delete control theControl of group "grpButtons" of stack "Map"
> end if
> end repeat
...
> What appears to be happening is that the number of controls is being reduced
> because of the deletions, and after a certain point the control to which the
> next x refers has been deleted. This seems like strange behaviour to me.
> Should "the number of controls" be re-evaluated on each iteration of the loop?
> But the number of iterations of x has been set at the start, and that does not
> get re-evaluated. I have checked this in the debugger and this is what is
> happening. About halfway through the process, the number of controls falls
> below the number of the next control to be deleted.
>
> What is the best way round this in Transcript?
repeat with x = the number of controls of group "grpButtons" of stack down
to 1
--
Richard Gaskin
Fourth World Media Corporation
Developer of WebMerge 2.1: Publish any database on any site
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
Tel: 323-225-3717 AIM: FourthWorldInc
More information about the use-livecode
mailing list