Page 1 of 2

functions from the message box

Posted: Mon Jun 13, 2016 6:12 pm
by Fermin
Hi.
I'm probably doing something wrong, but do not know what:

in the script of card:

Code: Select all

function calcular h1,h2
   return h1 + h2
end calcular
---------------------
on calcular h1,h2
   put h1 + h2
end calcular
("calcular" in Spanish means "calculate")
If I call these routines from the code of a button:

Code: Select all

on mouseup
   put calcular (12,3)
end mouseup
or

Code: Select all

on mouseup
   calcular 12,3
end mouseup
The result is 15 in both cases. Right.

But If I call these routines from the message box:

Code: Select all

calcular 12,3
The result is 12. It seems that only computes the first parameter.
And:

Code: Select all

put calcular (12,3)
The result is:

Message execution error:
Error description: Function: error in function handler
Hint: calcular


¿?¿?¿?

Re: functions from the message box

Posted: Mon Jun 13, 2016 6:45 pm
by Klaus
Just guessing, but having a function and a handler with the SAME name is asking for trouble! 8)
Does it work when you change the name of your function or handler?

Re: functions from the message box

Posted: Mon Jun 13, 2016 7:07 pm
by Fermin
I do not think so. I put it this way for example purposes. If I change the names or even remove one of the two, I guess it's the same. Anyway you left me with doubt ... As I can I try again :)
Thanks Klaus.

Re: functions from the message box

Posted: Mon Jun 13, 2016 7:56 pm
by Klaus
Maybe this is just a message hierarchy issue?

When I put this into the message box (and put the curor over my test stack): send "calcular 1,12" to cd 1 of the mousestack
I get 13 in the message box as exspected!

However the error descriptions are really not very helpful, that is true!

Re: functions from the message box

Posted: Mon Jun 13, 2016 8:33 pm
by Fermin
Well, I open one of my stacks. I put in the script of the card, the function

Code: Select all

function calcular h1,h2
   return h1*h2
end calcular
Then create a button and put in his script:

Code: Select all

on mouseUp
   put calcular (22,4)
end mouseUp
Click the button and I get:

88

Ok. Then I open the message box and write:

Code: Select all

put calcular (22,4)
I hit the return key and:

Message execution error:
Error description: Function: error in function handler
Hint: calcular

----
I'm starting to think I'm making a very silly mistake, but I can not see it... :lol:

Thank you for your patience, Klaus

Re: functions from the message box

Posted: Mon Jun 13, 2016 8:56 pm
by Klaus
No mistake, I am still convinced this is "just" a message hierarchy issue!

Re: functions from the message box

Posted: Mon Jun 13, 2016 9:09 pm
by dunbarx
WHAT IS GOING ON HERE???

Sorry, Ahem.

A single parameter associated with any function call at all, in either the card or stack script works fine:

Code: Select all

put calcular (22)
Forget for a moment that the function no longer does anything useful. At least it runs. But add another parameter, and the msg box version flat out fails. The message does not even start; a breakpoint in the card script does not catch a thing.

Confirmed in v 6.7x. I am going for a walk.

Craig Newman

Re: functions from the message box

Posted: Mon Jun 13, 2016 9:10 pm
by dunbarx
Klaus.

What is a message hierarchy issue? :shock:

Oh, never mind. It is the end of the world.

Craig

Re: functions from the message box

Posted: Mon Jun 13, 2016 9:25 pm
by dunbarx
I have no issues with command calls from msg, only function calls.

This is odd, because, and I could be remembering from HC, both types of calls are treated basically the same by the engine.

How has this gone unnoticed (especially by me) for so long? Or is it something relatively new? Anyone able to test in v5? v4?.

Craig

Re: functions from the message box

Posted: Mon Jun 13, 2016 9:27 pm
by Klaus
dunbarx wrote:What is a message hierarchy issue? :shock:
Oh, never mind. It is the end of the world.
EX-ACTLY! :D

I am not sure if the message box does put itself somewhere in between the existing message hierarchy
or if it is meant to do so at all!?

Re: functions from the message box

Posted: Mon Jun 13, 2016 9:30 pm
by Klaus
Looks like this is a known regression bug, introduced in LiveCode 8.0.1 RC1:
http://quality.livecode.com/show_bug.cgi?id=17800

Re: functions from the message box

Posted: Mon Jun 13, 2016 9:39 pm
by dunbarx
Klaus.

Since the beginning of time, the msg box has sent its tidbits directly to the card.

Craig

Re: functions from the message box

Posted: Mon Jun 13, 2016 9:41 pm
by dunbarx
It cannot be a "regression" if it is an issue in v6. No?

Anyway, I guess it is fixed in the latest v8.

Craig

Re: functions from the message box

Posted: Mon Jun 13, 2016 9:44 pm
by Klaus
dunbarx wrote:Since the beginning of time, the msg box has sent its tidbits directly to the card.
Aha, thanks, I was not sure about this!

Re: functions from the message box

Posted: Mon Jun 13, 2016 9:45 pm
by Klaus
dunbarx wrote:It cannot be a "regression" if it is an issue in v6. No?
Ask Panos, I was only quoting him! :)