Error Messages/43538
= Error message
- The OnClick attribute of the Button Bu1 recursively calls itself. A recursion is not allowed in a Button OnClick attribute.
Cause
You can "run" a button Bu1 from another button Bu2 by simply using Bu1's identifier by itself as an expression. But you can't tell a button to "run" itself, either directly or indirectly. So, for example, if you have two buttons with the following OnClick attributes, this error would result:
This would be an example of Bu1 indirectly running itself, since it runs Bu2, but Bu2 then runs Bu1.
When you do this, it almost certainly means you made a mistake.
Passing a handle parameter
One instance where this mistake is easy to make is when your button script is calling a function that accepts a handle parameter. Your function might want the calling button to identify itself, for example, but you forget to surround the parameter with a call to the Handle function.
Function HandleButtonPress( buttonPressed : handle ) ...
Button Bu1 OnClick : HandleButtonPress(Bu1) { oops! }
This causes the error because the parameter to HandleButtonPress gets evaluated as part of calling the function, causing a virtual recursive button press in the process. The correct calling syntax here would be
Button Bu1 OnClick : HandleButtonPress( Handle(Bu1) )
Enable comment auto-refresher