I think I have part of the answer.

Putting "return empty" at the end of myCommand handler eliminates the problem.  
Apparently, if you issue a command from the message box and the result is not empty, 
it posts the result.  That much makes sense.

What is surprising is that a message handler apparently defaults to using the return 
value of the last called non-built-in function as the return value for the handler, if 
you don't supply a return value yourself.  I haven't found anything in the 
documentation that confirms this non-intuitive behavior.

Is this a bug or a feature?



Bob Rasmussen wrote:

> (Rev 1.1.1B1)
>
> There seems to be an unintended interaction between send commands from the message 
>box and return data from scripted functions.
>
> The example here is pared down to the smallest case where I've seen the problem:
>
> I have a function in the script of stack "soandso" that looks something like this:
>
>   function myFunction
>     return "something interesting"
>   end my function
>
> Down the script a ways is the handler:
>
>   on myCommand
>     get myFunction( )
>     put "totally different"
>   end myCommand
>
> Now in the message box I type this:
>
>   send myCommand to stack "soandso"
>
> In the message box output field I see the words "totally different" flash for just 
>an instant. They are replaced immediately by the words "something interesting", even 
>though the return value was never put anywhere, let alone the message box.
>
> If I delete the put command in myCommand handler, the return value from myFunction 
>still shows up in the message box.  Whether or not myFunction has arguments or is 
>called with arguments makes no difference.
>
> If I invoke the handler from a button in the stack, the words "totally different"  
>appear in the message box, as expected, and they aren't replaced.  However, if I send 
>mouseUp to button "myButton" of stack "soandso", the weirdness returns.
>
> Note in all of this that if I call a built-in function instead of myFunction, 
>behavior is normal -- no leaks from function returns to the message box.  If I call 
>more than one of my own functions in myCommand handler, only the last one called has 
>its result appear in the message box.
>
> _______________________________________________
> improve-revolution mailing list
> [EMAIL PROTECTED]
> http://lists.runrev.com/mailman/listinfo/improve-revolution

_______________________________________________
improve-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/improve-revolution

Reply via email to