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

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

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

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

Post by trevix » Wed May 05, 2021 3:32 pm

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?
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

Klaus
Posts: 13823
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Wed May 05, 2021 4:07 pm

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

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

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

Post by trevix » Wed May 05, 2021 6:49 pm

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.
Attachments
TestGoStack.livecode.zip
(1.82 KiB) Downloaded 144 times
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

Klaus
Posts: 13823
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Wed May 05, 2021 6:56 pm

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

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

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

Post by trevix » Wed May 05, 2021 7:04 pm

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
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

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

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

Post by trevix » Wed May 05, 2021 8:53 pm

Apparently in the script i was trying to close a stack that was already closed.
Taking the line off, solved the problem.
Boh
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

Klaus
Posts: 13823
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Wed May 05, 2021 9:16 pm

AHA! :D

Glad you could solve it!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9655
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

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

Post by dunbarx » Wed May 05, 2021 9:21 pm

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

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

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

Post by trevix » Fri May 14, 2021 12:31 pm

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
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9655
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

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

Post by dunbarx » Fri May 14, 2021 2:44 pm

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

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

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

Post by trevix » Fri May 14, 2021 11:11 pm

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
Attachments
TestNavigation.livecode.zip
(2.87 KiB) Downloaded 110 times
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

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

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

Post by FourthWorld » Sat May 15, 2021 12:43 am

What is the benefit of constructing with a multi-window architecture for a single-window OS?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

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

Post by trevix » Sat May 15, 2021 9:13 am

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?
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

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

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

Post by FourthWorld » Sat May 15, 2021 9:23 am

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

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

Post by trevix » Sat May 15, 2021 9:32 am

....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.
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”