stumped: set script of buttons at runtime - solution A
Thanks for responding fellas,
From your unanimous replies it seems that the 60 lines of script I
was trying to set at runtime went over my limit....pardon me for
anyway, what Rob mentions below sounds like what I might need to do.
The thing I hadn't figured out that lead me down the present path was
that I couldn't figure out how to add the script to the template button.
>So for some
>reason, setting the script of a button at runtime does not seem
>possible. Does anyone know what I'm doing wrong here??
Runtime changes to scripts by standalones are subject to the 10-line
restriction the applies to the do command.
If you are not building the new script based on runtime info, you could
have a hidden template button containing the new script, change the
properties of the template button, and replace the old button with a
of the template.
Actually I think I misunderstood what you were saying. I thought you
meant something like this:
set the script of the templateButton to "ADD SCRIPT CODE HERE"
but you mean duplicate the button that is already on the card, and
then change its properties?
so my makebutton becomes
copy button "defaultButton"
set the name of it to "newButton"
set the location of it nnn,nnn
where button "defaultButton" contains all 60 lines of script that i
want each button to use. The only thing that needs to change is the
name of each button. I like that method better than my current
method. Hopefully that is what you intended. :)
I would recommend not putting 60 lines of script in your template
button...doing that means that every time you copy the button all 60
lines goes with it (10 buttons created means 600 lines of script, etc.)
Instead I would do something like this:
Then, the "DoMyCustomButtonMouseUpRoutine" handler or function can be
anywhere in the message path. What's nice about this is that if you
use this button in different stacks (or on different cards), each stack
or card could have its own version of the
DoMyCustomButtonMouseUpRoutine handler, making the button even more
If you need more control over which routine is called, you could pass
the name of the button to the DoMyCustomButtonMouseUpRoutine handler
and then make a decision about which routine to call based on the name.
put the short name of me into theShortName
> From: Rob Cozens <[hidden email]>
> Subject: Re: stumped: set script of buttons at runtime - solution A
> To: How to use Revolution <[hidden email]>
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset="us-ascii"; format=flowed
>> The thing I hadn't figured out that lead me down the present path was
>> that I couldn't figure out how to add the script to the template
> If you are building the script at runtime, my approach won't work. If
> you're selecting from a finite number of pre-written scripts, store
> script in a separate invisible template button.
> Rob Cozens