Smooth transition between stacks
William Prothero
waprothero at gmail.com
Tue Mar 20 18:39:53 EDT 2018
Folks:
This seems like it should be very easy, but I’m struggling.
I want, simply, to transition between stacks in a visually nice and clean way. I’m testing this out in the IDE, in livecode version 9.0.0 (Rc1) and I’m on Mac OS 10.13.3. I think I have a reasonable transition, but I want to close and remove the splash stack from memory. I can’t get it to do this. However, now I’m thinking that the splash stack will contain all of the code, and shouldn’t be purged. The project will have stacks for individual functions in the “Resources” folder.
How should I transition from one stack to another, and get the calling stack to leave memory when it’s launched the destination stack? My code won’t do it.
The splash stack has code like:
on mouseUp
put the short name of this stack into splashStackName
put splashStackName into appParams["splashStackName"]
put the filename of this stack into fName
set the itemdelimiter to "/"
delete the last item of fName
put "AppSetup-D3.livecode" into appSetupStackFileName
put "AppSetup-D3" into appSetupStackName
put appSetupStackName into appParams["appSetupStackName"]
put fName&"/"&appSetupStackFileName into stTarget
wait for 0 seconds with messages
go invisible to stack stTarget
send "doStackSetup "&splashStackName to stack appSetupStackName
end mouseUp
——The destination stack has this handler to initialize it.
on doStackSetup originStackName
put appParams["appSetupStackName"] into thisStack
set the rect of stack thisStack to the rect of stack originStackName
wait for 0 seconds with messages
show stack thisStack
send "doCloseThisStack "&stackName to me in 1 second
set the lockscreen to false
end doStackSetup
on doCloseThisStack
breakpoint
put "Start Earth Explorer" into stackName
set the destroyStack of stack stackName to true
close stack stackName
end doCloseThisStack
In the destination stack named appSetupStackName, I run code that accesses a database for configuration parameters. I don’t want the user to be required to click a button to initiate this process. I start it on an opencard handler.
I’ve fiddled with this way more time than I should have to. Does anyone have a nicely visual way of seamlessly going to another stack without screen flashing, windows jumping around, etc. I want the destination stack to just open in the same rect as the source stack.
I know that the opencard handler runs before the above mouseup code finishes.
Thanks for any advice.
Bill
More information about the use-livecode
mailing list