How to always close a substack when going to another substack?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: How to always close a substack when going to another substack?

Post by FourthWorld » Mon Oct 03, 2022 1:03 am

The comment from lead engineer Mark Waddingham two posts later in that thread seems to suggest "go...in window..." works on Android:

https://www.mail-archive.com/use-liveco ... 91689.html
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to always close a substack when going to another substack?

Post by jacque » Mon Oct 03, 2022 3:49 am

"go...in window..." does work on Android and iOS, though I never saw the point in general since there is only one window at any time on mobile devices. The one exception might be when applying a visual effect to the stack change but if I remember right we can do that by going to the new stack normally. It's been a while since I tried it.

I don't think that changes the messages though. Once the stack is in memory it stays there until specifically closed. A workaround might be to specifically send an opencard or openstack message (or the name of the handler that does the work) whenever the stack changes. I usually prefer to send a custom message so it's clear that it wasn't sent by LC.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: How to always close a substack when going to another substack?

Post by trevix » Mon Oct 03, 2022 11:04 am

Your answers make me think that I may have constructed my standalone (a main invisible stack and lot of substacks, each one with several cards) in the wrong way. But I am not sure that avoiding substacks (only one main and its cards) could have solved my problems.
For my experience, on Android I had black screens (somehow everything went invisible, locking the standalone) and refresh problems.

In order to do some testing, I created the attached stack, to be tested on Android 11 hardware.
But I didn't get to the "substack" problem since, just using the main card, I found some inconsistent (in my opinion) behaviours.

Experiment 1 (only pressing "next"):
- the second card is not resized
- on the third card (that is resized and hide the stack) I keep seeing the 2nd card (resized) with the third (red) visible.
- the above does not happens anymore after the first reiteration.

- Experiment 2:
- you press the button that make the stack invisible, the effect is that everything gets locked. The card is still visible but I guess that the stack becomes invisible for what concern its controls. Very dangerous behaviour since a single script mistake, defacto freezes your standalone.

I guess that before start testing the "in Window", I must understand what is going on on the above...
Attachments
OpenCardTest.livecode.zip
(2.24 KiB) Downloaded 57 times
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: How to always close a substack when going to another substack?

Post by trevix » Wed Oct 05, 2022 6:23 pm

Hello.
Does anyone know why adding "in window" to a "do" command throws an error?

Code: Select all

do "go card tXX of stack tYY in window of this stack"
Just to explain what I am doing this, the text for the "do" arrives via socket and works fine without the "in Window".
"In window" almost solved all my problems...

Thanks
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: How to always close a substack when going to another substack?

Post by trevix » Thu Oct 06, 2022 8:36 am

Also... go card "XX" of stack "YY" in window of this stack does not work if run into a script that is called by send.

the script of stack ZZ:

Code: Select all

...
on GoToStack
  get the defaultStack --it = "ZZ" correct
  go card "XX" of stack "YY" in windows of this stack 
end GoToStack
this does not work and throws an error on "go card..." of stack ZZ:

Code: Select all

send "GoTostack" to stack "ZZ"
This work:

Code: Select all

Lock Screen
go card 1 of stack "ZZ"
send "GoTostack" to stack "ZZ"
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: How to always close a substack when going to another substack?

Post by trevix » Thu Oct 06, 2022 8:42 am

@Jacque
...there is only one window at any time on mobile devices...
Can you absolutely confirm this? Note that I am talking about "sub-stacks"...
For what I have seen on Android, having 2 opened substack,if the front substack has a reduced size then the back substack, this last is partially visible.
Same if the front substack is made invisible with script.
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: How to always close a substack when going to another substack?

Post by FourthWorld » Thu Oct 06, 2022 5:07 pm

What Jacque wrote is the wisdom handed down from on high. We're told that on mobile stacks are always rendered at the full device screen size, so that only one is visible at any given moment.

I haven't tried to open another stack and try to resize the top one smaller. It's interesting that you were able to do that. Given the guidance on this, I have to wonder about the implications, about useful ways to use multiple stacks on mobile. For example, I can envision some utility in being able to use two different stacks for the top and bottom of a display.

When the top stack was rendered, did it show a border or drop shadow around its edges?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to always close a substack when going to another substack?

Post by jacque » Thu Oct 06, 2022 7:22 pm

If you aren't using fullscreenmode or scripting the resizing of the stack, then stacks are rendered at their natural size. A smaller one will appear to be drawn on top of the previously opened one.

Substacks are always in memory but there is only one actual window on mobile. I think what you're seeing is a redraw issue. LC only redraws the window content and leaves the areas around the window untouched. The larger stack window content will show around the smaller one.

This was an issue until it was fixed several versions ago, at least when using fullscreenmode. In your case you might have success if you set the backgroundcolor of the smaller stack to black or some other color. LC should use that to redraw the area around the edges. But the recommended solution is to resize all stacks to fit the current mobile screen.

I haven't tried that except in fullscreenmode mode but it's worth a try.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: How to always close a substack when going to another substack?

Post by FourthWorld » Thu Oct 06, 2022 8:17 pm

jacque wrote:
Thu Oct 06, 2022 7:22 pm
I think what you're seeing is a redraw issue.
Damn. For a moment the possibilities were enticing.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: How to always close a substack when going to another substack?

Post by trevix » Thu Oct 06, 2022 11:31 pm

Code: Select all

 I think what you're seeing is a redraw issue
Yes. Apparently this is the thing (see attached stack).

By the way ,I decided to avoid the "in window" solution, since it is getting a lot of errors in the different situations I am having in my standalone.
In this demo stack I use instead a short command on the main stack ("CloseOtherStacks") and "r_" prefix on the stacks that need to be closed. This seems to work.
If you see a potential problem with this, please let me know.
Attachments
OpenCardTest2.livecode.zip
(100.99 KiB) Downloaded 62 times
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to always close a substack when going to another substack?

Post by jacque » Fri Oct 07, 2022 12:04 am

FourthWorld wrote:
Thu Oct 06, 2022 8:17 pm
jacque wrote:
Thu Oct 06, 2022 7:22 pm
I think what you're seeing is a redraw issue.
Damn. For a moment the possibilities were enticing.
I suppose you could experiment with stacks that are half-height and carefully place them. The inactive one would basically just be an image but...? On the other hand, LC may decide to position any active window at the top-left of the screen, which wouldn't work at all. If you try it, let us know.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: How to always close a substack when going to another substack?

Post by FourthWorld » Fri Oct 07, 2022 2:04 am

Honestly, I can't think of any practical think I'd do with it that I couldn't do with groups. Tantalizing, but without purpose for me. Besides, these days all the mobile stuff I'm doing is web. Still using LC for desktop apps, where it shines brighter than any star.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”