stumped: set script of buttons at runtime - solution A

Emilio Gagliardi emilio at ualberta.ca
Thu Jun 16 12:54:37 EDT 2005


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  
saying, but...>:(

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.
Hi Eric,

 >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  
other
properties of the template button, and replace the old button with a  
copy
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. :)

Thank you guys for your feedback.

Emilio


More information about the use-livecode mailing list