Merging Stacks?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm

Merging Stacks?

Post by Ralph Forehand » Mon Dec 07, 2009 5:03 pm

I have two main stacks "One" and Two".

I want to make stack "Two" a substack of stack "One"?

What procedure do I use?
"Do the right thing and everything else will take care of it's self."

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Merging Stacks?

Post by bn » Mon Dec 07, 2009 5:34 pm

Ralph,
go to stack "Two", open the properties inspector, on the basic properties there is an option to choose a main stack for stack "Two"
regards
Bernd

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm

Re: Merging Stacks?

Post by Ralph Forehand » Mon Dec 07, 2009 6:11 pm

Thank You very much for your quick reply.

I did as you suggested and saved both stacks

But Stack "Two" does not become a substack of stack "One" and when I reopen stack "Two" it shows itself as the Main Stack.

My stack "Two" is a model DialogBox I want to call in stack "One"
"Do the right thing and everything else will take care of it's self."

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Merging Stacks?

Post by bn » Mon Dec 07, 2009 6:39 pm

bn wrote:go to stack "Two", open the properties inspector, on the basic properties there is an option to choose a main stack for stack "Two"
here you choose stack "One" as the mainstack and then you save. Close Rev. Restart Rev. There should not be a stack "two" anymore, because if all went well stack "two" is now a substack of stack "One". It works for me this way. No idea why it is not working for you. Then you tweak your substack to modeless palette toplevel slider or whatever.
regards
Bernd

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm

Re: Merging Stacks?

Post by Ralph Forehand » Mon Dec 07, 2009 8:45 pm

Stack "Two" simply refuses to become a substack of main stack "one"

Stack "Two" allows me to change it's main stack to stack "One", save it, restart Rev, but then when I reopen;
stack "Two" it' s main stack still shows as :stack "Two"
Stack "One" does not include "Two" as a substack and can not find "Two" on the model stack "Two" command
Stack does not vanish.

Thanks for your patience and suggestions.
"Do the right thing and everything else will take care of it's self."

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Merging Stacks?

Post by bn » Mon Dec 07, 2009 8:55 pm

Ralph,
again, I just don't know why this happens. Some ideas that don't necessarily apply here: you call your stack "one" and "two". Try to avoid reserved words in naming things. Rev is known to behave funny in this situation. Always use some other notation, never use a reserved word. Also, even if it works and you call that object from a handler and you don't quote your string you might never find out why the handler does not work.
In your case: why dont you start by creating a new stack and then right away a substack from the menu for this new stack. That at least should work. Then you copy/paste the controls from stack "One" and "Two" to the new stack and substack.
regards
Bernd

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm

Re: Merging Stacks?

Post by Ralph Forehand » Mon Dec 07, 2009 10:17 pm

Bernd,

Thanks for hanging in there.

I used "One" and "Two" only for my example names, and the actual stack names are legal.

I tried the Main -->> subStack approach and it didn't work out - it does add the subStack to the main stack and I could copy and paste the controls over from my one card Dialog Box - but the main stack model stack call still can't find it. I triple checked the naming too.

Unfortunately, I can't easily redo the main stack as it's very complex with multiple backgrounds, cards, etc.

At this point I'm about to throw in the towel and just use Revs basic Ask and Answer Dialogs as a work-around. Not as elegant as a custom Dialog Box but ,,,,

Thanks Again for you help, Have a nice Holiday Season and TAKE CARE,
Ralph
"Do the right thing and everything else will take care of it's self."

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

Re: Merging Stacks?

Post by FourthWorld » Mon Dec 07, 2009 10:34 pm

If all else fails you could make a clone of the stack you want to be your mainstack, save it so it has a file name, and set the mainstack of the other one to the newly-saved mainstack.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm

Re: Merging Stacks?

Post by Ralph Forehand » Tue Dec 08, 2009 1:41 pm

Richard,

Thank You for your suggestion. It didn't work for me though.

My main stack is a converted HyperCard stack and I'm wondering if that has anything to do with it?

Anyway, I haven't totally given up yet but will try a couple more things. It might just be something really simple - ONCE I Find IT!?

Thanks Again and TAKE CARE.
"Do the right thing and everything else will take care of it's self."

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

Re: Merging Stacks?

Post by Klaus » Tue Dec 08, 2009 2:55 pm

Hi Ralph,

did you really check stack "One" and its SUBSTACKS?
I bet there is a substack "TWO" of stack "ONE" :-)

Setting the mainstack of an open stack does NOT delete the original FILE of that stack!
So if you open the file "TWO.REV" it surely is still its own mainstack!


Best

Klaus

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

Re: Merging Stacks?

Post by FourthWorld » Tue Dec 08, 2009 4:54 pm

At what specific point did it not work?

I do stuff like that all the time, so I know it works.

It won't matter if either of those stacks was originally an HC stack, as long as it's been saved in Rev format first.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm

Re: Merging Stacks?

Post by Ralph Forehand » Wed Dec 09, 2009 2:14 am

Klaus,

Thank You for the info on the subStack status following it's change. All appears as it should now.

Richard,

You are right - your suggestion does work correctly. I had a spelling error leading me to miss-interpret the source of my problem.

Thanks for the method and your affirmation that H/C wouldn't cause me the problem.

Now I'm working on fixing a message path problem.

Thanks Again and TAKE CARE.
"Do the right thing and everything else will take care of it's self."

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

Re: Merging Stacks?

Post by FourthWorld » Wed Dec 09, 2009 6:15 am

Glad that worked out.

Anything we might be able to help with on the message path issue?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm

Re: Merging Stacks?

Post by Ralph Forehand » Wed Dec 09, 2009 2:41 pm

FourthWorld wrote:Glad that worked out.

Anything we might be able to help with on the message path issue?
Thanks for offering. Yes, all help is appreciated.

My situation is this; I have a main stack #A that consist of several cards.
1. Card #3 has a button "X" script that calls subStack #B (a Dialog Box)
2. subStack #B's "OK" button script builds "myString" that becomes dialogData
3. dialogData is passed back to the button "X" script (So Far So Good)
4. Button "X"'s script manipulates the dialogData cs elements and should end.
BUT gives me an error message;
" executing at 8:42:54 AM
Type Chunk: no such object
Object (main Stack #A)
Line put icon of cd btn "Quarter"-1900 into Quarter
Hint Quarter",

and somehow does not end and tries to execute the main stack "A" script!

I'm missing something (passing a mouseUp??) somewhere?

Thanks for any ides and TAKE CARE.
"Do the right thing and everything else will take care of it's self."

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

Re: Merging Stacks?

Post by Klaus » Wed Dec 09, 2009 2:58 pm

Hi Ralph,

looks like the script cannot find the desired button, but will, if you add a long descriptor!
Note that, when the script executes, the current card might not contain the button "Quarter"!
...
put the icon of btn "Quarter" OF CD "Name of Card with the button on it" OF STACK "Name of stack with the card with the button on it"...
...

Hope that helps!


Best

Klaus

Post Reply