Hi Nicolas,

Nicolas R Cueto wrote:
> 
> Hello,
> 
> Two questions I would welcome help with:
> 
> 1. Is a script modifiable only through Script Editor?


No. It is an object/card/stack property and can be set like other
modifiable properties.


> On one card I have 20 buttons whose script is the same but which I now want
> to change, preferably with some sort of repeat loop rather than manually
> button by button, e.g.,:
> 
> repeat with i = 1 to the number of buttons on this card
> put/replace <new script> into the script of button i
> end repeat
> 
> In hindsight, I should've scripted some sort of subroutine.


Good idea. To do the same kind of thing from several buttons, but with
different values in each case, you can put a handler in each button
script that issues a command message with a parameter or two (or
twenty!) thrown in. Like this:

-- button 1 --
on mouseUp
  setColor "green", "yellow"
end mouseUp

-- button 2 --
on mouseUp
  setColor "blue", "white"
end mouseUp

-- button 3 --
on mouseUp
  setColor "205,205,143","orange"
end mouseUp

-- in the card script (or somewhere in the hierarchy between the button
& the MC engine) --
on setColor pNewBackColor, pForeColorNew
  set the backColor of fld "text" to pNewBackColor
  set the foreColor of fld "text" to pNewForeColor
end setColor

Doing things this way makes it a lot easier to introduce script changes
later.


> 
> 2. Whenever I clone a mainstack its substacks do not also get cloned, so,
> until now, I've been cloning stacks substack by substack by substack by ...
> Is there an easier way?


One way:
At the desktop level (outside of MC) you could duplicate and rename the
stackfile, and then open it with MC and rename the stacks as needed.


> 
> Thank you.
> 
> Nicolas R Cueto

-- 
Phil Davis
------------------
[EMAIL PROTECTED]

Reply via email to