Hello,
I am rather new to Runtime Revolution and this is my first post...
I am trying to find out how to send data back from a stack to the handler that opened that stack.
The idea: a create a "Calendar" stack that is to be used to allow the user to enter a select two dates: start date and end date. This calendar can be called from different stacks/cards, therefore from different handler. When the user close the calendar stack, i would like to return the dates to the "caller". I could like to avoid using global variables...
Thanks for any tips you could give me.
Regards
François (from Belgium)
Passing values from a stack to its caller
Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller
-
- Livecode Opensource Backer
Re: Passing values from a stack to its caller
Welcomebrainois wrote:I am rather new to Runtime Revolution and this is my first post...

We discussed these issues on the use-list about a month ago. I have archived the quite long discussion on my code website at Passing parameters to other stacks.brainois wrote:I am trying to find out how to send data back from a stack to the handler that opened that stack.
Very many options exist. It may be easier to provide easy to follow examples if you provide some of your own code. I go for an "abstract" description here.
1. What you want is the result of a handler.
Code: Select all
send "handler_name" to stack "that_other_stack"
put the value_to_pass of stack "that_other_stack" into tValue
Code: Select all
set the value_to_pass of me to "something"
2. What you want is the result of a function.
- put value("function_name()", stack "that_other_stack") into tValue
Some calendar stacks can be found on Rev Online. Why not download the rev Online Picker on So Smart Software, then search for "date" or "calendar"?brainois wrote:The idea: a create a "Calendar" stack that is to be used to allow the user to enter a select two dates: start date and end date. This calendar can be called from different stacks/cards, therefore from different handler. When the user close the calendar stack, i would like to return the dates to the "caller".
And this is an excellent choice. Custom properties can be accessed from anywhere within a stack (even when substacks are included) and provide a cleaner option than global variables.brainois wrote:I could like to avoid using global variables...
If you really need a function but are keen to use customprops, then you can always use a wrapping handler which has no function other than call the real function and store the value returned by that real function into a custom property of name "value_to_pass"
Code: Select all
on handler_name
put handler_name() into tValue
set the value_to_pass of me to tValue
end handler_name
--
function handler_name
... actual processing taking place here ...
return "something"
end handler_name
brainois wrote:François (from Belgium)
Living abroad, but from

