How to always close a substack when going to another substack?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
How to always close a substack when going to another substack?
Hello.
This thing is getting me crazy since I thought to have fixed it, but the problem keep returning on me...
- My standalone, running on mobile, is made of a "main" stack and around 15 substacks, each one with several cards.
- The "main" stack becomes invisible after launch, when the code move the UI to substacks. Some service code is in it but should not be a problem for what follows.
- When I move from a substack "comingFrom" to another substack, I need to always run the "openCard" of the substack "goingTo".
- In order to do this, I must be sure that the substack "comingForm" always gets closed when leaving and, before that, eventual pending messages gets cancelled.
- Eventual pending messages on a substack are used to run slow loop (advertising style) between the cards of the substack. So I cannot use the "Closecard" message to simply close the substack.
- On mobile, Android, having two substacks opened and visible sometime confuses the "topStack", so that the standalone gets blocked by the wrong top card.
- "SuspendStack" is not a good solution since the user can leave the standalone for another app and then return to it.(and anyway I use this message for local notifications)
I know how to do all this, but things are getting really confused, because of how my standalone has been constructed.
1) Is there a simple way to accomplish this that I don't know about?
2) Is there a missing "on LeaveStack" message sort of that I can use to close the left over when changing substack?
3) Should I, when going to a substack, use "the openstacks" to always run a loop to close all the other substack ?
I hope to have been cleare enough and thanks for any suggestions...
This thing is getting me crazy since I thought to have fixed it, but the problem keep returning on me...
- My standalone, running on mobile, is made of a "main" stack and around 15 substacks, each one with several cards.
- The "main" stack becomes invisible after launch, when the code move the UI to substacks. Some service code is in it but should not be a problem for what follows.
- When I move from a substack "comingFrom" to another substack, I need to always run the "openCard" of the substack "goingTo".
- In order to do this, I must be sure that the substack "comingForm" always gets closed when leaving and, before that, eventual pending messages gets cancelled.
- Eventual pending messages on a substack are used to run slow loop (advertising style) between the cards of the substack. So I cannot use the "Closecard" message to simply close the substack.
- On mobile, Android, having two substacks opened and visible sometime confuses the "topStack", so that the standalone gets blocked by the wrong top card.
- "SuspendStack" is not a good solution since the user can leave the standalone for another app and then return to it.(and anyway I use this message for local notifications)
I know how to do all this, but things are getting really confused, because of how my standalone has been constructed.
1) Is there a simple way to accomplish this that I don't know about?
2) Is there a missing "on LeaveStack" message sort of that I can use to close the left over when changing substack?
3) Should I, when going to a substack, use "the openstacks" to always run a loop to close all the other substack ?
I hope to have been cleare enough and thanks for any suggestions...
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: How to always close a substack when going to another substack?
Hi.
I am not getting why the "closeStack" message is slowing down your app. In any case, does "closeCard" also do that? Is it possible that you can work that message to your advantage?
"leaveStack" is adorable, but already implemented as "suspendStack" as you already know.
Assuming that closeStack really has such an influence, can you use "openStack" to close all other stacks? This seems like a very roundabout way of doing this, and I wonder if it also will slow things down. You could test for all stacks that are not the topStack...
Craig
I am not getting why the "closeStack" message is slowing down your app. In any case, does "closeCard" also do that? Is it possible that you can work that message to your advantage?
"leaveStack" is adorable, but already implemented as "suspendStack" as you already know.
Assuming that closeStack really has such an influence, can you use "openStack" to close all other stacks? This seems like a very roundabout way of doing this, and I wonder if it also will slow things down. You could test for all stacks that are not the topStack...
Craig
Re: How to always close a substack when going to another substack?
Let me explain, is not a matter of slowness:I am not getting why the "closeStack" message is slowing down your app.
Making thing simple, there is a substack "BoxLoop" with 3 cards that, when the app is in standby , change every 4 seconds (using send in time).
When my socket library in the standalone receives a message (from another app of mine), the message received is 2 lines that are handle with a "do":
Code: Select all
set the cLoopRunning of stack "BoxLoop" to false
go card "cardXOfOtherSuBstack"
Code: Select all
SetProp cLoopRunning pValue
if not pValue then
cancel sMessageID --ID of running send, otherwise the close stack won't work
send "close me" to me in 500 milliseconds
end if
end cLoopRunning
Similar situations are in several part of the standalone.Assuming that closeStack really has such an influence
I do most of card preparation and localization on PreOpenCard (actually localization only for long text, using revprofile for control names), so the fact that the PreOpenCard are run is important. If there is a SubStack2 open behind the top SubStack1, the next time I go to SubStack2 the PreOpenCard wont run.
I could use this, as I mentioned:
Code: Select all
On Openstack
put the short name of me into tIsMe
put the openstacks into tOpenstacks
repeat for each line tStack in tOpenstacks
if not ....-- filter tIsMe and service stacks
close stack tStack
end if
end repeat
end PreOpenStack
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
Re: How to always close a substack when going to another substack?
I forgot:
I tried to find out what is going on Android using the remote debugger (which I bought) but for some reason (local network confusion?) the remote debugger does not stop any more after the first breakpoint.
PS Let me tell you...the remote debugger need a serious rework, in my opinion. It is alway failing randomly, particularly showing variables.
I tried to find out what is going on Android using the remote debugger (which I bought) but for some reason (local network confusion?) the remote debugger does not stop any more after the first breakpoint.
PS Let me tell you...the remote debugger need a serious rework, in my opinion. It is alway failing randomly, particularly showing variables.
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
Re: How to always close a substack when going to another substack?
Not sure I really understand your problem since LC will load a complete stack including substacks into RAM
so there may be no difference if the stack is "open" or not.
If you want to close a stack after going to another one I would do something like:
so there may be no difference if the stack is "open" or not.
If you want to close a stack after going to another one I would do something like:
Code: Select all
...
put the short name of this stack into tOldOne
go stack "the other substack"
close stack tOldOne
...
Re: How to always close a substack when going to another substack?
The difference is that if the stack is open, albeit behind another, going to its first card will not run the preOpencard message.
At least, this happens on Android.
At least, this happens on Android.
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
Re: How to always close a substack when going to another substack?
AHA!
OK, get it now, thanks.
OK, get it now, thanks.
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: How to always close a substack when going to another substack?
Well, if you really cannot use "suspendStack" and resumeStack", and of course you know these two are just what you need, you can always make a kludge and a half.
I made two stacks. On the first one I made a button that was as large as the card, and put this in its script;
If I navigate to the second card and go back to the first, I get three beeps. Did I mention this was a kludge? Put the button behind all the other controls and make it unobtrusive. Now change the beep line into a call to some useful handler. But does this do it?
Craig
I made two stacks. On the first one I made a button that was as large as the card, and put this in its script;
Code: Select all
on mouseWithin
if the newlyOpened of this card is "true" then
set the newlyOpened of this card to "false"
beep 3
end if
end mouseWithin
on mouseLeave
set the newlyOpened of this card to "true"
end mouseLeave
Craig
Re: How to always close a substack when going to another substack?
mmmh....thanks but this is going to make my standalone rather difficult to control, since I am using MouseLeave in controls.
I was wondering how much am I going into trouble if I use a global to keep the name of previous substack and be able to always close it.
What could go wrong?
Then there is the "destroyStack" property: does it apply to substacks also or just to stacks. The alarming msg in the dictionary makes me puzzled:
I was wondering how much am I going into trouble if I use a global to keep the name of previous substack and be able to always close it.
Code: Select all
global gClosingStack
on OpenStack
if gClosingStack is not empty AND gClosingStack <> the short name of me then close stack gClosingStack --just in case
put the short name of me into gClosingStack
end Openstack
Then there is the "destroyStack" property: does it apply to substacks also or just to stacks. The alarming msg in the dictionary makes me puzzled:
I have to modify a lot of stuff in my standalone, in order to implement this, so any suggestion is welcomed....If you open and close many stacks in a session, and the destroyStack of all these stacks is false, the memory used by these stacks will continue growing until you quit the application.
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: How to always close a substack when going to another substack?
Well. as for using "mouseLeave" in other controls, you can always pass it along.
And as for using a global instead of a custom property, why? They do the same thing, sort of, but custom properties survive sessions, so you do not have to load them each time.
And as for taking this kludgey pathway seriously, I never thought it actually an option. But kludges work as well as any other methodology, as long as they are well constructed. The main issue is to make sure that the card sized "invisible" button does not get in its own way, or in the way of anything else.
Craig
And as for using a global instead of a custom property, why? They do the same thing, sort of, but custom properties survive sessions, so you do not have to load them each time.
And as for taking this kludgey pathway seriously, I never thought it actually an option. But kludges work as well as any other methodology, as long as they are well constructed. The main issue is to make sure that the card sized "invisible" button does not get in its own way, or in the way of anything else.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: How to always close a substack when going to another substack?
I never actually understood the "destroyStack" property, even though I use it. Stacks seem to linger in memory somehow regardless. Jacque had some things to say on this years ago.
Anyway, apart from taking up memory, which should not be an issue these days (stacks in the IDE only take kiloBytes of memory) I doubt you will ever have to think about this.
Craig
Anyway, apart from taking up memory, which should not be an issue these days (stacks in the IDE only take kiloBytes of memory) I doubt you will ever have to think about this.
Craig
Re: How to always close a substack when going to another substack?
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 7230
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: How to always close a substack when going to another substack?
Destroystack is the same as the menu item "Close and remove from memory". It ensures that whenever the user clicks the close box in the title bar, the stack is completely removed. However, it does not apply to substacks because the entire stackfile is always kept in memory.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 9833
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: How to always close a substack when going to another substack?
Does "go...in window..." not work on Android?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: How to always close a substack when going to another substack?
Hello.
The last I know on "go..in window", is the 2018 conversation https://www.mail-archive.com/use-liveco ... 91646.html and related bug, which is somehow difficult for me to follow (but apparently solved).
"...In window" is always been a rather obscure method. Scarce mentions on the dictionary, impossible to search on the forum search, etc.
Are you suggesting that this method works fine on mobile platforms, for going back and forth from substack to substack and have the "openStack", "open card", etc. always sent, no matter what?
That is, the "in window" close the "ShortNameOfOldStack" substack? Even on Android?
Thanks
The last I know on "go..in window", is the 2018 conversation https://www.mail-archive.com/use-liveco ... 91646.html and related bug, which is somehow difficult for me to follow (but apparently solved).
"...In window" is always been a rather obscure method. Scarce mentions on the dictionary, impossible to search on the forum search, etc.
Are you suggesting that this method works fine on mobile platforms, for going back and forth from substack to substack and have the "openStack", "open card", etc. always sent, no matter what?
Code: Select all
go card "x" of stack "ShortNameOfNewStack" in window of "ShortNameOfOldStack"
Thanks
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>