Equivalence to the SuperCard function call "via" object

Ken Ray kray at sonsothunder.com
Mon Jul 7 23:08:00 EDT 2003


Joel,

The value() function is what you need, but to include parameters, you
need to include them like a "do". That is, if the parameter is a
variable you need to "&" it. I ran your test like this:

Script of button 1:
-------------------
on mouseUp
  put "Hello" into tMyVar
  put "Goodbye" into tAnotherVar
  answer value("getSomeData(1,the date," & tMyVar & "," & tAnotherVar &
")",btn 2)
end mouseUp

Script of button 2:
-------------------
function getSomeData p1,p2,p3,p4
  -- p1 is a number, p2 is a date, p3 is a string, p4 is a string
  return p1&&p2&&p3&&p4
end getSomeData

When I clicked button 1, I got:

  1 7/7/03 Hello Goodbye

(which is what I expected). So variables are not evaluted before they
are sent to the object - you need to force them to evaluate by "&"-ing
them as in my example above.

Does this help?

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 


> -----Original Message-----
> From: use-revolution-admin at lists.runrev.com 
> [mailto:use-revolution-admin at lists.runrev.com] On Behalf Of 
> Joël Guillod
> Sent: Monday, July 07, 2003 12:00 PM
> To: use-revolution at lists.runrev.com
> Subject: Re: Equivalence to the SuperCard function call "via" object
> 
> 
> I am trying to do what Supercard do with the function...via. 
> That is I want that the function is evaluated by the script 
> of the specified object.
> 
> E.g.:
> 
> In Supercard you can write :
> 
>  put getSomeData(1,the date,tMyVar,tAnOtherVar) via btn 
> "MyButton" of \
>    cd 10 of stack "someStack" into tMyResult
> 
> How to translate that into rev?
> 
>  -- does not work:
>  send "get getSomeData(1,the date,tMyVar,tAnOtherVar)" to \
>    btn "MyButton" of cd 10 of stack "someStack" into 
> tMyResult  put it into tMyResult
> 
>  -- does not work or dont give the expected result:
>  get value("getSomeData(1,the date,tMyVar,tAnOtherVar)", \
>    btn "MyButton" of cd 10 of stack "someStack")
>  put it into tMyResult
> 
>  -- work around but not elegant:
>  -- getSomeData is no more a function but a handler...
>  call "getSomeData "1,the date,tMyVar,tAnOtherVar" of \
>    btn "MyButton" of cd 10 of stack "someStack"
>  put the result into tMyResult
> 
> Of course, putting the script of the target object in the 
> message path is some other possibility but I would exclude 
> this for implementation reason.
> 
> Maybe the "function via object" a feature for the wish list?
> 
> Or did I miss something?
> 
> Joel
> 
> > Message: 9
> > Date: Sat, 5 Jul 2003 06:40:44 -0700
> > To: use-revolution at lists.runrev.com
> > From: "Jeanne A. E. DeVoto" <jeanne at runrev.com>
> > Subject: Re: Equivalence to the SuperCard function call "via" object
> > Reply-To: use-revolution at lists.runrev.com
> > 
> > At 1:30 AM -0700 7/5/03, Joël Guillod wrote:
> >>>> Is there an equivalent to the following Supercard statement?
> >>>> 
> >>>> functionName([paramList]) via object
> >> 
> >> YES I did but it does not behave as described in the docs, 
> only the 
> >> "me" keyword is related to the optional object param.
> > 
> > 
> > What exactly are you trying to do?
> > 
> > --
> > Jeanne A. E. DeVoto ~ jeanne at runrev.com
> > Runtime Revolution Limited - Software at the Speed of Thought 
> > http://www.runrev.com/
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com 
> http://lists.runrev.com/mailman/listinfo/use-> revolution
> 





More information about the use-livecode mailing list