Thank you to all that has contributed, you have all been help.
However, it still doesn't quite allow me to do what I want. I think I need to explain a little further.
Once my MIAW has loaded, and calculations are performed, the result needs to be returned via an OK button.
Can we still get it to work and return a result to my variable.
Regards
Jon
You have neglected to say where the calculations are being performed (in the Stage movie or the MIAW) & where this 'OK' button is (on the Stage or in the MIAW)
the easiest would be to put the calculated result into a variable & for the ok to access that global variable
-Buzz
On 31/1/05 8:42 pm, "Pedja" <[EMAIL PROTECTED]> 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>> programming Lingo. Thanks!]
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
[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!]
