After Compiling App: Can I Add Files

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ChristopherBodell
Posts: 52
Joined: Sun Jan 20, 2008 7:06 am

After Compiling App: Can I Add Files

Post by ChristopherBodell » Sat Mar 15, 2008 5:26 pm

Does anyone know how i can add a stack to an app that i made.

For Example if I created an application to be like a slide show or something, and name it "slide_show_1," is there a way that i can make another app and put it into the same directory as the first one and have a button or something run a command saying, "set the mainStack of this stack to stack "slide_show_1".

Once the application is compiled, do the stacks still count as stacks outside of the application? If anyone can help that would be great.

Many Thanks,
Christopher

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sat Mar 15, 2008 5:52 pm

Hi Christopher,

If you added a script to the standalone that searches for the stacks, it is possible. Otherwise, no.

Suppose you have a list field in your stack, called "Stacks". When the standalone opens, you could fill the field like this:

Code: Select all

on preOpenStack
  set the itemDel to slash
  put item 1 to -2 of the effective filename of this stack into myPath
  put the defaultFolder into myOldDir
  set the defaultFolder to myPath
  put the files into myList
  filter myList with "*.rev"
  put myList into fld "Stacks"
  set the defaultFolder to myOldDir
end preOpenStack
Now you have a field with the stacks.
Set the script of the field to the following:

Code: Select all

on mouseUp
  set the itemDel to slash
  put item 1 to -2 of the effective filename of this stack into myPath
  put the defaultFolder into myOldDir
  set the defaultFolder to myPath
  put slash & the selectedText of me after myPath
  set the defaultFolder to myOldDir
  go stack myPath in new window
end mouseUp
This way, you always have access to the stacks that are in the same folder as your standalone. Note, on the Mac, your stacks need to be in the same folder as the executable inside the application package.

The defaultFolder-stuff may or may not be necessary, you might also use different way to find the stacks. I've just added it to be a bit complete.

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

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Sat Mar 15, 2008 6:07 pm

If you make stacks part of a standalone, none of them can be saved. But you can load any stack from another file into your standalone, as Mark demonstrated.

There are often confusions about what a stack is, when it's in a file (and which file), and where to put them in standalones for saving. Because there are 3 different (yet similar) things in Rev that are called stacks, I have compiled this List once:
  1. Stacks are files, most often with the suffix ".rev"
  2. Stacks are part of files when they're called mainstacks and substacks
  3. Each stack file has exactly one mainstack
  4. A stack file can have many substacks
  5. A mainstack and all it's substacks which are an executable can't be saved
  6. Mainstacks and substacks can also exist only in memory, without being within files or executables
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

ChristopherBodell
Posts: 52
Joined: Sun Jan 20, 2008 7:06 am

So......

Post by ChristopherBodell » Sat Mar 15, 2008 10:38 pm

So there really is not way to edit the mainStacks and substacks of an application after its been compiled by revolution?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sat Mar 15, 2008 10:43 pm

Hi Christopher,

You can edit the stacks, but you can't save them, because you can't save standalones once they have been built.

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

ChristopherBodell
Posts: 52
Joined: Sun Jan 20, 2008 7:06 am

Ok

Post by ChristopherBodell » Sun Mar 16, 2008 3:01 am

Ok, that's what i thought. Thanks for your time.

Thank You,
Christopher

Post Reply