Page 1 of 1

Open card of substack in the same window

Posted: Thu Jun 04, 2020 7:48 am
by anmldr
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

Re: Open card of substack in the same window

Posted: Thu Jun 04, 2020 8:37 am
by FourthWorld
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

Re: Open card of substack in the same window

Posted: Thu Jun 04, 2020 9:18 am
by Klaus
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

Re: Open card of substack in the same window

Posted: Thu Jun 04, 2020 10:00 am
by FourthWorld
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.

Re: Open card of substack in the same window

Posted: Thu Jun 04, 2020 10:42 am
by Klaus
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.

Re: Open card of substack in the same window

Posted: Thu Jun 04, 2020 6:08 pm
by FourthWorld
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.

Re: Open card of substack in the same window

Posted: Thu Jun 04, 2020 6:51 pm
by anmldr
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