stumped: set script of buttons at runtime - solution A

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

stumped: set script of buttons at runtime - solution A

Emilio Gagliardi
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
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: stumped: set script of buttons at runtime - solution A

Rob Cozens
Eric,

>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.

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 each
script in a separate invisible template button.

Rob Cozens

"I cannot do great things;
  but I can do small things with great love."

         -- Mother Teresa

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: stumped: set script of buttons at runtime - solution A

Frank Leahy
In reply to this post by Emilio Gagliardi
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:

on mouseUp
        DoMyCustomButtonMouseUpRoutine
end mouseUp

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
versatile.

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.
  For example:

on mouseUp
        put the short name of me into theShortName
        DoMyCustomButtonMouseUpRoutine theShortName
end mouseUp


Regards,
-- Frank

Web Photos Pro: Software for Photo Bloggers and Other Photo Power Users
See us on the web at http://www.webphotospro.com/

On Jun 17, 2005, at 8:08 AM, [hidden email]
wrote:

> 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
>
> Eric,
>
>> 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.
>
> 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
> each
> script in a separate invisible template button.
>
> Rob Cozens

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution