Sequential Layout of Script-created Objects

Jeanne A. E. DeVoto jeanne at runrev.com
Sat Dec 7 18:40:25 EST 2002


At 4:56 AM -0800 12/7/02, Bernard Devlin wrote:
>I have a couple of questions:
>1) do created buttons have to be placed in a group?  (The Transcript
>documentation seems to say so, and playing around with permutations of the
>examples didn't work).

Not unless you want them to behave as a radio button cluster, or otherwise
want them in a group for whatever reason. (What part of the docs are you
looking at? It sounds like something was confusing and may need to be
rephrased.)


>2) the above code lays any new buttons on top of the old buttons when the code
>is run again.  I am sure I can get hold of the contents of the group
>"grpButtons" in order to delete each old button, but I don't know how.

You can run through each button in a repeat loop:

  repeat with x = 1 to the number of controls of group "grpButtons" of
stack "Map"
    delete control x of group "grpButtons" of stack "Map"
  end repeat

If you decide the buttons don't need to be grouped, you can repeat over the
number of controls in the stack, and delete the control only if it's a
button (or use whatever criterion you need to make sure you don't
accidentally delete objects you want to keep):

  repeat with x = 1 to the number of controls of this card of stack "Map"
    if word 1 of the name of control x of this card of stack "Map" is "button"
    then delete control x of this card of stack "Map"
  end repeat

--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
Runtime Revolution Limited - The Solution for Software Development
http://www.runrev.com/





More information about the use-livecode mailing list