Open card of substack in the same window

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
anmldr
Posts: 459
Joined: Tue Sep 11, 2012 11:13 pm

Open card of substack in the same window

Post by anmldr » Thu Jun 04, 2020 7:48 am

I have a button in my main stack that has the code

Code: Select all

on mouseUp pMouseButton
   go to card "cd1" of stack "MySubStack" of stack "MyMainStack"
end mouseUp
The correct card opens but in a new window. How do I specify that it should open in the same window?

Thank you,
Linda

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Open card of substack in the same window

Post by FourthWorld » Thu Jun 04, 2020 8:37 am

anmldr wrote:
Thu Jun 04, 2020 7:48 am
I have a button in my main stack that has the code

Code: Select all

on mouseUp pMouseButton
   go to card "cd1" of stack "MySubStack" of stack "MyMainStack"
end mouseUp
The correct card opens but in a new window. How do I specify that it should open in the same window?

Code: Select all

go card "cd1" of staxk "MySubStack" of stack "MyMainStack" in window "MyOpenWindowTitle"
From the Dictionary's go command:
https://livecode.com/resources/api/#livecode_script/go
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Open card of substack in the same window

Post by Klaus » Thu Jun 04, 2020 9:18 am

Important:
That will only work if both stacks have identical dimensions (width/height)!

But this is correct behavior: a stack (main or sub) = a window

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Open card of substack in the same window

Post by FourthWorld » Thu Jun 04, 2020 10:00 am

Klaus wrote:
Thu Jun 04, 2020 9:18 am
Important:
That will only work if both stacks have identical dimensions (width/height)!
Gracefully. It can still work with stacks of other sizes, but you probably won't like how the source stack gets resized to fit the destination stack.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Open card of substack in the same window

Post by Klaus » Thu Jun 04, 2020 10:42 am

Oh, then the mothership must have changed this sometime in the past.
Last time I used this, OK, must have been ages ago :-), the stacks had to be of the same dimensions.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Open card of substack in the same window

Post by FourthWorld » Thu Jun 04, 2020 6:08 pm

It's certainly a good idea to make sure that both stacks are the same size. Maybe the docs noted that as a guideline rather than a card rule? I can't recall; last time I used the docs for guidance on that was with MetaCard.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

anmldr
Posts: 459
Joined: Tue Sep 11, 2012 11:13 pm

Re: Open card of substack in the same window

Post by anmldr » Thu Jun 04, 2020 6:51 pm

Having the windows the same size is what I like and what I was doing so this is great for me.

Also a little shorter version is to use:

Code: Select all

go to card "cd1" of stack "theSubstack" in window of this stack
Thank you so very much. This is fun.
Linda

Post Reply