Wow, I never came across that one (the result) before! Good to know. But as Sean has pointed out, it's no more needed with DMX2004 where the improved object model allows to directly call a miaw's handlers.
Valentin Pedja wrote: > The way to capture a return value from a MIAW is to use "the result" > function... > > It works this way: > > -- the MIAW (let's call it window "myWindow") does whatever it's > supposed to > do > > on doSomething x > y = x + 1 > return y -- this is where the value is returned > end > > > -- the stage trigers a handler in the above miaw and captures the > return > value > > x = 1 > tell window "myWindow" > doSomething(x) -- or if you are not sending anything the just > doSomething() with parenthesis "()" > end tell > pVar = the result -- this variable will capture whatever the handler > within > the MIAW has returned > > > That's it...you can use the same method "the result" to capture any > return > values from a handler although within the same movie it's easier to > just > asign a variable to the whole handler > > E.g: > > on mouseUp > x = 1 > pValue = doSomething(x)--when calling a handler that returns a > value you > must use parenthesis at the end () > put pValue > end > > > -- somewhere else in the same movie you have the doSomething handler > > on doSomething x > y = x + 1 > return y -- you must use the "return" statement to return the > calculation > back > end > > Hope this helps > > Pedja > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Valentin > Schmidt > Sent: 31 January 2005 19:34 > To: Lingo programming discussion list > Subject: Re: <lingo-l> Objects: One for the gurus > > > sorry, my last mail contained some accidental junk script due to > copying and > pasting. so here again: > > you could either use a global: > > global gData > > gData = 23 > window("something").open() > tell window("something") > foo() > end tell > put gData > -- 46 > > and in something.dir: > > on foo > global gData > gData = gData * 2 > end > > > > OR, use a list as parameter to implement passing by reference: > > > window("something").open() > data = 23 > tmpList = [data] > tell window("something") > foo(tmpList ) > end tell > put tmpList[1] > -- 46 > > and in something.dir: > > on foo (tList) > tList[1] = tList[1]*2 > end > > > Valentin > > > Jon Alongi wrote: >> Hi people/gurus, >> >> >> I hope someone can help me. >> >> >> I have for hours been trying to work out a solution to no avail. >> >> Does anyone know if it is possible and how to return a value from a >> MIAW. >> >> I am using an object to open up a MIAW, perform a calculation, and >> would then like the result returned to my variable. >> >> For example: >> >> MyVariable = fileIO.dosomething("parameter") >> >> >> Parent script >> >> On doSomething me, paremter >> >> Window("something").open() --perform calculation in the MIAW >> >> RETURN data >> End >> >> >> >> >> Is this even possible. >> >> Id really welcome the advise, no matter how unorthodox. >> >> >> >> Best Regards >> >> >> Jon >> >> >> >> >> [To remove yourself from this list, or to change to digest mode, go >> to http://www.penworks.com/lingo-l.cgi To post messages to the list, >> email [email protected] (Problems, email >> [EMAIL PROTECTED]). Lingo-L is for learning and helping with >> programming Lingo. Thanks!] > > [To remove yourself from this list, or to change to digest mode, go to > http://www.penworks.com/lingo-l.cgi To post messages to the list, > email > [email protected] (Problems, email [EMAIL PROTECTED]). > Lingo-L is > for learning and helping with programming Lingo. Thanks!] > > > > > > [To remove yourself from this list, or to change to digest mode, go > to http://www.penworks.com/lingo-l.cgi To post messages to the list, > email [email protected] (Problems, email > [EMAIL PROTECTED]). Lingo-L is for learning and helping with > programming Lingo. Thanks!] [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [email protected] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
