Does closeStack trigger in the iOS simulator?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 15
- Joined: Mon Jul 11, 2011 8:12 pm
Does closeStack trigger in the iOS simulator?
The "closeStack" message seems to work fine when closing a stack from within LiveCode but does not seem to trigger for me when running the same stack in the simulator. It also does not work on my iPhone.
See the attached stack and here is the code:
-------------------------------------------------------------------------------------------------------------
on openStack
put "Time stamp: " & the MyTimeStamp of this stack into field "TimeStampField"
end openStack
on closeStack
set the MyTimeStamp of this stack to the milliseconds
save this stack
pass closeStack
end closeStack
-------------------------------------------------------------------------------------------------------------
What I expect is that each time the stack closes it updates the stack custom property "MyTimeStamp". Then, each time the stack is opened it displays the previously saved "MyTimeStamp" in the field "TimeStampField"
What I get is the time stamp that was placed in the custom property while I executed it from within LiveCode and the value never changes.
LiveCode build 1445 4.6.3
xCode 4.1
Steven (Colorado, USA)
See the attached stack and here is the code:
-------------------------------------------------------------------------------------------------------------
on openStack
put "Time stamp: " & the MyTimeStamp of this stack into field "TimeStampField"
end openStack
on closeStack
set the MyTimeStamp of this stack to the milliseconds
save this stack
pass closeStack
end closeStack
-------------------------------------------------------------------------------------------------------------
What I expect is that each time the stack closes it updates the stack custom property "MyTimeStamp". Then, each time the stack is opened it displays the previously saved "MyTimeStamp" in the field "TimeStampField"
What I get is the time stamp that was placed in the custom property while I executed it from within LiveCode and the value never changes.
LiveCode build 1445 4.6.3
xCode 4.1
Steven (Colorado, USA)
Re: Does closeStack trigger in the iOS simulator?
You can't make an app from a stack, make changes to that stack at runtime, and then save that stack - the app bundle can't be modified at run time. You can only save stacks that are being run from one of the allowed folders on the device. So your app will need a launch stack that on first launch writes the main stack to the Documents folder, and then goes to that stack (it goes directly to the stack on subsequent launches). You can save that stack.
Gerry
Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.
Former LiveCode developer.
Now recovering.
Re: Does closeStack trigger in the iOS simulator?
Hi all,
in this case here it might suffice to "spit out" a little text
file and read it in when the app starts the next time:
Definitively NO need to save the stack
Best
Klaus
in this case here it might suffice to "spit out" a little text
Code: Select all
on closestack
put the millisecs into url("file:" & specialfolderpath("documents)" & /myTimeStamp.txt")
###...
end closestack
Code: Select all
on openstack
if there is a file (specialfolderpath("documents)" & /myTimeStamp.txt") then
put url("file:" & specialfolderpath("documents)" & /myTimeStamp.txt") into fld "TimeSTampField"
else
## optional
put empty into fld "TimeSTampField"
end if
end openstack

Best
Klaus
Re: Does closeStack trigger in the iOS simulator?
Yeah I thought of that (and do it my own apps) but it seemed a good opportunity to explain why the mechanism being used was failing 
gerry

gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.
Former LiveCode developer.
Now recovering.
-
- Posts: 15
- Joined: Mon Jul 11, 2011 8:12 pm
Re: Does closeStack trigger in the iOS simulator?
Gerry, Klaus,
Thanks so much for this information. The pair of responses is perfect. I needed the explanation of why the mechanism was failing and also needed to learn about the special folder path.
Thanks so much.
I'll let you know when the app is in iTunes!
Steven
Thanks so much for this information. The pair of responses is perfect. I needed the explanation of why the mechanism was failing and also needed to learn about the special folder path.
Thanks so much.
I'll let you know when the app is in iTunes!
Steven
Re: Does closeStack trigger in the iOS simulator?
Hi Steven,
glad we could be helpful in both respects
Ah, and welcome to the forum!
Best from germany
Klaus
glad we could be helpful in both respects

Ah, and welcome to the forum!
Best from germany
Klaus