Page 1 of 2

Go card x of stack y in the window of this stack

Posted: Wed May 05, 2021 3:32 pm
by trevix
On mobile, (LC 9.6.2 indy) I need to do a visual effect transition going from one substack to another substack.
I found this method on the forum (viewtopic.php?t=6927)

Code: Select all

put "Card" && quote & "Main" & quote && "of stack" && quote & tStack & quote into gCDmain
go gCDmain in the window of this stack
Not willing to fire the preopenstack I modified it like this (but it shouldn't matter...)

Code: Select all

put "Card" && quote & "Main" & quote && "of stack" && quote & tStack & quote into gCDmain
lock messages
go gCDmain in the window of this stack
unlock messages
Everything works except that after this code the standalone becomes unresponsive, at least for a little while(?!)
Like, buttons don't do any action anymore, but no error messages of any sort.
On the development environment everything works fine. But being on Indy I cannot check what is going on the mobile hardware.
Any suggestion?

Re: Go card x of stack y in the window of this stack

Posted: Wed May 05, 2021 4:07 pm
by Klaus
Hi Trevix,

there is definitivly no need to do anything your way, this will do:

Code: Select all

go cd "Main" of stack "another stack" in window of this stack
I would set a GLOBAL variable or custom property and check it in the "pre-/openstack" handlers of your (sub-)stacks.
Obviously the "lock messages" is making problems.
On mobile, (LC 9.6.2 indy) I need to do a visual effect transition going

Code: Select all

...
lock screen for visual effect
go cd "Main" of stack "another stack" in window of this stack
unlock screen with visual dissolve
...
Best

Klaus

Re: Go card x of stack y in the window of this stack

Posted: Wed May 05, 2021 6:49 pm
by trevix
Taking off the "lock messages" does not solve my problem.
Must be something else that is difficult for me to pin, without having a mobile debugger.
Ayway, I attach a demo stack that at least works fine, for other to use.

Re: Go card x of stack y in the window of this stack

Posted: Wed May 05, 2021 6:56 pm
by Klaus
trevix wrote:
Wed May 05, 2021 6:49 pm
Taking off the "lock messages" does not solve my problem.
I did not say this, I proposed to set a "flag" (global variable or custom property) and you "pre-/openstack" handlers take care of that:

Code: Select all

global do_not_execute_preopenstack
on preopenstack
   if do_not_execute_preopenstack then
     exit preopenstack
   end if
  ## more stuff to do
  ## ...
end preopenstack
Then when you want to go to the substack:

Code: Select all

...
global do_not_execute_preopenstack
put TRUE into do_not_execute_preopenstack
lock screen for visual effect
go cd "Main" of stack "another stack" in window of this stack
unlock screen with visual dissolve
...
Get the picture?


Best

Klaus

Re: Go card x of stack y in the window of this stack

Posted: Wed May 05, 2021 7:04 pm
by trevix
Yes, this is what I did, putting a flag and so on.(good suggestion)
The preopenstack now does not run if I need not to.
But this was not the problem.

When I am going from substack B to substack A, with the "open in window" etc, everything is fine.
In the the substack A then everything works.
BUT if thenI try to go back to substack B, the screen does not change(it stay sub A) but the clicking response like if i were in sub B.
Note: as i said, only on mobile. On the OSX is fine.
Got the idea?
Thanks for the help

Re: Go card x of stack y in the window of this stack (SOLVED)

Posted: Wed May 05, 2021 8:53 pm
by trevix
Apparently in the script i was trying to close a stack that was already closed.
Taking the line off, solved the problem.
Boh

Re: Go card x of stack y in the window of this stack

Posted: Wed May 05, 2021 9:16 pm
by Klaus
AHA! :D

Glad you could solve it!

Re: Go card x of stack y in the window of this stack

Posted: Wed May 05, 2021 9:21 pm
by dunbarx
Hi.

It is almost always some forgotten or invisible (or both) gadget loitering around. This could be a control or a line of code.

Drives me nuts, especially since it is and was always me.

Craig

Re: Go card x of stack y in the window of this stack

Posted: Fri May 14, 2021 12:31 pm
by trevix
Something is still not working or not clear to me:

Code: Select all

...
lock screen for visual effect
go cd "Main" of stack "A" in window of this stack
unlock screen with visual dissolve
close stack "B" --the stack i was coming from
...
After this, clicking on cd "Main", which is correctly shown, is like clicking on the buttons of the substack I was coming from ("B", which by the way I closed at the end of the script)!!!
Is there a command to be added to the the end of the script above, so that the stack "A" is in its window and respond correctly to user interaction?
I tried "set the default stack to..." to no avail.
Should I run at the end of the script another go cd "main" of stack "A" in Windows of this stack (uh!)
This is very confusing

Re: Go card x of stack y in the window of this stack

Posted: Fri May 14, 2021 2:44 pm
by dunbarx
Hi.

I made a pair of test stacks, "xxx" and "yyy". I put most of your handler in a button on "xxx":

Code: Select all

on mouseUp
   lock screen for visual effect
   go stack "yyy" in window of this stack
   unlock screen with visual dissolve
   close stack "xxx" --the stack i was coming from
end mouseUp
Works fine.

If you are navigating "in window" you do not need to close the "starting" stack. LC is being told to work within a single window.

Also, I did not see the visual effect. Navigation to another stack did not seem to work, whereas going to another card in the same stack certainly does. So you may not need three of the lines in your handler. But the dictionary states that it should.

I may be misunderstanding the command. Anyone?

Craig

Re: Go card x of stack y in the window of this stack

Posted: Fri May 14, 2021 11:11 pm
by trevix
I did a test stack (see attachment) and I found the followings:

- doing a search on the dictionary about "purge" doesn't bring any result (purge stack and purge window probably deserve some clarification)

- On the development environment, on the test stack, once back to substack "sub1" from "sub2", you need to press twice the central button in order to go back to "Sub2". UNLESS you move slightly the pointer (?). That is, if you carefully don't move the mouse, the first click doesn't bring any action

- on the iOS simulator the above doesn't apply

- I cannot reproduce my problem on mobile, when I see a substack but clicks do action on the stack I was before (like if it was not refreshed). Mobile only.

- going to stack "in window", always close the stack where you come from, while going simply to stack, as in the example, leaves "Sub1" opened (as it should)

Can someone explain how this "in window" works?
Thanks

Re: Go card x of stack y in the window of this stack

Posted: Sat May 15, 2021 12:43 am
by FourthWorld
What is the benefit of constructing with a multi-window architecture for a single-window OS?

Re: Go card x of stack y in the window of this stack

Posted: Sat May 15, 2021 9:13 am
by trevix
For what i know it is the only way to apply visual effect to transition between stacks (no,I can't use cards since my app is big enough to be spread across at least 15 substacks).
Are you saying, forget visual effect, like sliding from screen to screen?

Re: Go card x of stack y in the window of this stack

Posted: Sat May 15, 2021 9:23 am
by FourthWorld
Visual effects can also be used when going between cards.

They can even be used on a given card, such as when hiding or showing groups.

Re: Go card x of stack y in the window of this stack

Posted: Sat May 15, 2021 9:32 am
by trevix
....transition between stacks...
I already have transitions between cards.

Unfortunately I have to apply transitions also between substack, in order to give the user a logic of its navigation in the App, that is become more and more complex.