second instance of a stack
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 73
- Joined: Sat Apr 08, 2006 6:51 pm
second instance of a stack
how do you say
on mouseUp
open a copy of this stack in a new window and go to card XYZ of the newly opened stack
end mouseUp
on mouseUp
open a copy of this stack in a new window and go to card XYZ of the newly opened stack
end mouseUp
In nova fert animus mutatas dicere formas corpora.
Hi Preston,
Untested, but should work.
Best,
Mark
Code: Select all
on mouseUp
put the mainstack of this stack into myMainStack
clone this stack
put it into myNewStack
set the mainstack of myNewStack to myMainstack -- optional
go cd "XYZ" of myNewStack
end mouseUp
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 73
- Joined: Sat Apr 08, 2006 6:51 pm
Mark wrote:Hi Preston,
Untested, but should work.Code: Select all
on mouseUp put the mainstack of this stack into myMainStack clone this stack put it into myNewStack set the mainstack of myNewStack to myMainstack -- optional go cd "XYZ" of myNewStack end mouseUp
Best,
Thanks so much! You are a prince among men. I had to add "stack"
on mouseUp
put the mainstack of this stack into myMainStack
clone this stack
put it into myNewStack
set the mainstack of myNewStack to myMainstack -- optional
go cd "XYZ" of stack myNewStack
end mouseUp
Mark
In nova fert animus mutatas dicere formas corpora.
This is not true.mcgrath3 wrote:Be careful as clone makes an exact copy with the same name as the original and this could cause some confusion in the message path. So if you do make a clone the first thing to do is rename the stack.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 73
- Joined: Sat Apr 08, 2006 6:51 pm
Hi Preston,
You get the error message because you do have a stack with that name already, perhaps because you clone twice.
In a standalone, error messages don't appear by default, but they do occur and you should not ignore them.
Best,
Mark
You get the error message because you do have a stack with that name already, perhaps because you clone twice.
In a standalone, error messages don't appear by default, but they do occur and you should not ignore them.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 5
- Joined: Thu Apr 24, 2008 5:54 pm
- Contact:
I just made a copy of a file in the Mac finder, rather than rely on my 99.95% memorymcgrath3 wrote:Be careful as clone makes an exact copy with the same name as the original and this could cause some confusion in the message path. So if you do make a clone the first thing to do is rename the stack.

Would that kind of concept help prevent confusion ? Would all the cards need name changes ?
George Wade
Horseshoe Bay
West Vancouver
"Japanese was easy
RunRev is different..!"
Horseshoe Bay
West Vancouver
"Japanese was easy
RunRev is different..!"
No once the stack is renamed then each card can retain the same name. This is because the actual card is named: card "MyName" of stack "MyStack" ---- and ---- card "MyName" of stack "MyStackRenamed"
I usually use the whole name like this to avoid any issues with same name cards etc.
The same is true for objects: btn "MyButton" of card "MyName" of stack "MyStack" is different than btn "MyButton" of card "MyName" of stack "MyStackRenamed"
In a cloned stack there are now two stacks with the same scripts running that are calling items that are named the same and if you only write things like - send mouseUp to btn "MyButton" in 5 - then it could send this message to either btn "MyButton" when it comes down the object path.
It is just cleaner to use the whole object path to avoid these things.
Also, if you choose to change 'ALL' names in a stack then close the one stack and do a find/replace on the other stack for each name you want to change. find "MyButton" replace "MyButtonTwo"
HTH
Tom McGrath
I usually use the whole name like this to avoid any issues with same name cards etc.
The same is true for objects: btn "MyButton" of card "MyName" of stack "MyStack" is different than btn "MyButton" of card "MyName" of stack "MyStackRenamed"
In a cloned stack there are now two stacks with the same scripts running that are calling items that are named the same and if you only write things like - send mouseUp to btn "MyButton" in 5 - then it could send this message to either btn "MyButton" when it comes down the object path.
It is just cleaner to use the whole object path to avoid these things.
Also, if you choose to change 'ALL' names in a stack then close the one stack and do a find/replace on the other stack for each name you want to change. find "MyButton" replace "MyButtonTwo"
HTH
Tom McGrath
Tom McGrath III
Lazy River Software
3mcgrath@comcast.net
Lazy River Software
3mcgrath@comcast.net