replace a substack | SOLVED

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
Johan_VH
Posts: 67
Joined: Fri Mar 28, 2014 2:46 pm

replace a substack | SOLVED

Post by Johan_VH » Mon Aug 04, 2014 1:54 pm

Hi,

I've made so many changes to a substack that is used for all my projects that I'm working on, that I would rather be able to just remove the old substacks and replace them with the new one. I've save the new substack to a separate file, but I don't find any information to import it as part of my mainstack now. Is this at all possible?

Thanks,

Johan
Last edited by Johan_VH on Mon Aug 04, 2014 1:58 pm, edited 1 time in total.

Johan_VH
Posts: 67
Joined: Fri Mar 28, 2014 2:46 pm

Re: replace a substack

Post by Johan_VH » Mon Aug 04, 2014 1:57 pm

I was too fast posting a question about it. I just figured it out myself.

Just in case anyone else ever has the same issue: Open the new stack, go to the property inspector of the stack and in 'basic properties' select the main stack it should belong to. :D

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

Re: replace a substack

Post by Klaus » Mon Aug 04, 2014 1:58 pm

Dag Johan,

this is simple:
1. Delete the old substack and save the mainstack
2. QUIT Livecode (may not be neccessary, but I am cautious after 15 ears of using this software!) 8)
3. Restart and open the mainstack and the new substack, which is still another mainstack.
4. In the Inspector for the new substack, set its mainstack to your "main" stack and save.
5. Done :)

Best

Klaus

Johan_VH
Posts: 67
Joined: Fri Mar 28, 2014 2:46 pm

Re: replace a substack | SOLVED

Post by Johan_VH » Mon Aug 04, 2014 2:10 pm

Thanks again Klaus!

I will go the safe way and do it again with saving and quitting now.

Follow up question: is it possible to have my substacks that are the same for all my projects (in my case the screensaver and the registration) in a central location and link to them from every project so they only get packaged together when I make my runtime?

Johan

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

Re: replace a substack | SOLVED

Post by Klaus » Mon Aug 04, 2014 4:49 pm

Dag Johan,
Follow up question: is it possible to have my substacks that are the same for all my projects (in my case the screensaver and the registration)
in a central location and link to them from every project so they only get packaged together when I make my runtime?
yes, there are several ways to do so!

One might be this:
When you create a standalone your mainstack will receive the message "savingstandalone" so you could catch this message and write
script that will make these stacks SUBSTACKS of the standalone mainstack.

Something like this (out of my head!):

Code: Select all

on savingstandalone
  put "path/to/your library/stack.livecode" into tStack
  lock messages
  go stack tStack
  set the mainstack of stack tStack to "name of your standalone mainstack here..."
  close stack tStack
  unlock messages
end savingstandalone
Or if all these stacks are already open in Livecode when you create the standalone, you can address these stacks directly:

Code: Select all

...
set the mainstack of stack "your libstack1" to "name of your standalone mainstack here..."
...
Another way is to add these stacks via the "Copy fiels" TAB in the standalone builder settings and late "start using" them as a "library":
Thsi should go into the standalone mainstack script:

Code: Select all

on openstack
  start using stack "path to/lib/stack.livecode"
  ## ...
end preopenstack
You get the picture :D


Best

Klaus

Post Reply