Tips for multi-stack app?
J. Landman Gay
jacque at hyperactivesw.com
Thu Jul 22 00:58:55 EDT 2010
On 7/21/10 11:09 PM, Jeff Massung wrote:
> -- from stack A
> send "newWidget" to group "Editor" of stack "B"
>
> This command sends just fine, but the handler (which works fine) fails in
> the middle because it references other controls on stack B:
>
> copy group "Widget" into ...
>
> And this fails because (I think) Rev is looking for group "Widget" on stack
> A and not stack B - where the handler is executing. Then I come across the
> defaultStack property, and because calling the "newWidget" handler, I set
> that to be stack "B". Seems fine, except the handler still has the same
> problem.
>
> Any suggestions for me? I have to think this is a very common thing.
Right, common problem. There are a few ways to deal with it.
First way: use long references.
copy grp "widget" of this cd of stack B...
Second, the defaultstack was invented just to avoid that, so:
set the defaultstack to B
copy grp "widget" to...
With this one, you have to be careful because if the same handler
references something in stack A, you need a long reference for A's control.
Third way: check out the "call" command. It may not be appropriate
because I'm not sure which stack should be the referenced one in your
case, but "call" is exactly like "send" except that the context remains
in the calling stack rather than in the stack that was "sent" to. So if
you do this:
call "myHandler" of stack B
The context for all object references will still be stack A.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list