AnimateObject and Subroutine with Parameter - Forum

Forum Navigation
Embarcadero contest retweet
You need to log in to create posts and topics.

AnimateObject and Subroutine with Parameter

In the AnimateObject action, we can use a subroutine after the action is finished.  But I can't seem to pass a parameter to the subroutine I want to run without errors.

I want to use the GotoPage action in a subroutine which requires the page Id as a string for a parameter.

This code gives error, I've tried various different methods..

AnimateObject "menuPanel" "230" "0" 500 "linear" "GoToPageAfterAnimate MainPage"

I vaguely remember that I ran into this issue before, but I can't remember how I solved it..

Hi @darbdenral, AnimateObject does not have any options for sending parameters to the callback subroutine.
You should use a different subroutine for each target page or use JavaScript instead.
Sorry!

@darbdenral
@luishp

You should use a different subroutine for each target page or use JavaScript instead.

... or reserve a variable for the parameter e.g. ...

SetVar "[param1ForAnimateSubroutine]" "Page3"
AnimateObject "menuPanel" "230" "0" 500 "linear" "animateSubroutine"

 

... the subroutine can then access the preset value in [param1ForAnimateSubroutine] ... and navigate accordingly.

Note: this method allows for multiple parameters to be set/accessed.

@luishp
@gaev

Gaev, the variable method is a good work around..  That should work fine.. ;)

Thank you both for your help.

Open chat
1
Do you need more info?
Hi, do you have any doubt?