Converting HyperCard stacks to separate file substacks

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Kay Tate
Posts: 22
Joined: Mon Aug 13, 2007 3:41 am

Converting HyperCard stacks to separate file substacks

Post by Kay Tate » Sun Feb 01, 2009 8:11 pm

I built a number of very successful stacks in HCard. They are all opened from my old HCard Home card, sort of like my own desktop. Some of the stacks are quite large.

I converted them to run on Rev using a trial of Studio. I have a primary stack that has a bunch of links on it that open substacks that are in separate files. On my development platform, it works fine.

When I package this up as a standalone and try to run it on Linux, only the main stack would open, so I captured an strace. The file opens for the substacks all refer to the main stack file name instead of to the correct file names for the substacks. I made sure that all of the files were copied over to the application, and the substacks and file names all seem to be there. Is this a bug? Or am I yet missing something?

I also tried to build it for Mac OS X intel and as a fat binary. None of them work. If I can't get this to work, I will have to abandon my HCard and Rev productivity tools in a new job!

Thanks for any advice.
-Kay T.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Post by mwieder » Sun Feb 01, 2009 8:51 pm

"substacks that are in separate files"...

Are these in separate files in your development environment or are they substacks of the main stack? If they're substacks, when you created the standalone did you select the checkbox to make them separate files? If so, you may need to set the defaultFolder before opening them. Or make sure they're in the same folder as the mainstack (or same place in the app structure).

Kay Tate
Posts: 22
Joined: Mon Aug 13, 2007 3:41 am

Post by Kay Tate » Mon Feb 02, 2009 7:10 am

mwieder wrote:"substacks that are in separate files"...

Are these in separate files in your development environment or are they substacks of the main stack? If they're substacks, when you created the standalone did you select the checkbox to make them separate files? If so, you may need to set the defaultFolder before opening them. Or make sure they're in the same folder as the mainstack (or same place in the app structure).
I do have the "move substacks into individual stack files" checked, and the list of files and the list of stacks are both what I would expect. I can see them all in the application folder in what looks like the correct structure.

So let me be sure I understand you. I need to have a single directory with the main stack in a file and each substack in a file - right? I'll try it this way.

The thing that is very odd is that Rev tried to open the correct directory structures (two of the substacks are in subdirectories of the directory where the other substacks are located. This subdirectory structure was correctly created in the standalone.) It was just that all of the file opens were for the same stack file name, "Kay's Home.rev" instead of for the correct file names for each substack.

Thanks.
-Kay T.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Post by mwieder » Mon Feb 02, 2009 7:26 am

"I do have the "move substacks into individual stack files" checked..."

I stopped doing this a while back because I kept having surprises like you're running into. Now if I need separate substacks they're that way in my development environment during the design phase. Then when I go to build a standalone everything's the way it was when I developed the app. YMMV.

Let's see: I think you have to put the substacks into the same folder in the app on OSX. You'll need to open the app itself to do this. Right-click on the app, select Contents, then MacOS. Drag the substacks in there at the same level as the app. Does that do the trick?

Maybe we should take a step back... Do you really need the substacks to be separate files? If you're trying to make them modifiable (data stacks), it won't work that way. Try a splash screen approach instead.

Kay Tate
Posts: 22
Joined: Mon Aug 13, 2007 3:41 am

Post by Kay Tate » Mon Feb 02, 2009 7:26 am

I have continued to look through postings for other things that I may be missing. Is there some syntax I have to use to ensure that the correct file gets opened for a substack if it is not in the main stack? The buttons I have been using in the development environment just say
on mouseUp
open first card of stack "Kay's Logs" in a new window
end mouseUp
Am I missing something?

Thanks.
-Kay T.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Post by mwieder » Mon Feb 02, 2009 8:10 am

Right - but in the development environment your substacks are... er... substacks of the mainstack. If they were in a different folder from the mainstack you'd either have to use an absolute location (ugh) or use the defaultFolder property. Assuming the substacks are in a subfolder located in the same folder as the app:

set the defaultFolder to "Kay's substacks"
open the first card of stack "Kay's Logs" in a new window

or, if you want to put the substacks in the user's documents area:

set the defaultFolder to specialFolderPath("Documents")
etc.

Kay Tate
Posts: 22
Joined: Mon Aug 13, 2007 3:41 am

Post by Kay Tate » Tue Feb 03, 2009 5:13 am

mwieder wrote:Right - but in the development environment your substacks are... er... substacks of the mainstack. If they were in a different folder from the mainstack you'd either have to use an absolute location (ugh) or use the defaultFolder property. Assuming the substacks are in a subfolder located in the same folder as the app:

set the defaultFolder to "Kay's substacks"
open the first card of stack "Kay's Logs" in a new window
I tried this, and it didn't help. I think, however, I have finally cracked the code. I opened one of my stacks and said "save as a separate file" and overwrote the existing file with the same file. This worked. My strace didn't work, so I'm not sure what the open looked like, but I will do that to check.

In development, I had created the current substacks as stacks originally, which they were in HCard. Then I converted them to be substacks of the main stack. They looked like they they were substacks, but there was some missing link internally from the main stack to the substack that was not created without checking this button. I will have to see how to save them in the future.

As to why I have separate files, these substacks are things like my notebook where I take notes in meetings. They are hundreds of pages (cards) in a month. I can almost take dictation on calls. They are just too large to keep intact, so I replace my notebook every 6 months with a new stack and keep the old ones for archival searches which saves me frequently. Am I missing something I should be doing here?

Thanks for your advice and counsel! I really appreciate the thoughts.
-Kay T.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Post by mwieder » Tue Feb 03, 2009 6:06 am

"overwrote the existing file with the same file."

...that's bizarre, but I'm glad it worked.

Here's my take on what I think I understand about what you're trying to do: It's not going to work that way. Substacks are just that: parts of a single application. You can't modify a running application in any platform (OSX, Windows, linux). It's not a rev failing, it's the way operating systems work.

One idea is to do basically what you were doing in HC: have the data stacks as separate stacks (and therefore separate files.

The alternative is to use a splash screen approach, where your splash screen stack has nothing except a launcher for a different stack. That different stack is what is now your mainstack, except you don't need to make it into a standalone.

Make the splash screen into a standalone, then you can develop your mainstack in the IDE and when you run the splash screen standalone it will launch your mainstack and run it just like in the IDE. Here's the code in the splash screen stack script:

Code: Select all

on startup
  hide this stack
  close this stack
  go stack the uTargetStack of this stack
end startup
then put the name of your mainstack into the uTargetStack of the splash screen stack and build the splash screen.

I prefer the splash screen approach for a number of reasons: there aren't any surprises when you build a standalone for distribution because what you've been developing is exactly what you deliver; you can issue updates to users easily by just sending them a small stack instead of having to rebuild the app; you can make changes to the app and then quickly run it as a real application. I thought there was a tutorial on how to do this, but I can't find it right now.

Kay Tate
Posts: 22
Joined: Mon Aug 13, 2007 3:41 am

Post by Kay Tate » Tue Feb 03, 2009 6:41 am

mwieder wrote:
One idea is to do basically what you were doing in HC: have the data stacks as separate stacks (and therefore separate files.

The alternative is to use a splash screen approach, where your splash screen stack has nothing except a launcher for a different stack.
Thanks. I may not have been using terminology correctly, but this is pretty much what I have. The substacks are the data files. I have a static card that has the buttons to launch the different substacks. I'll have to look more into the splash screen thought -- sounds cooler. :-)

Thanks again.
-Kay T.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”