Page 1 of 1

Libraries and reusing stacks

Posted: Mon Oct 20, 2008 7:17 am
by morbug
Sometimes my mind just refuses to understand some things, like the use of Libraries in Rev. I've read lots of forum posts, the user manual, fourthworlds guide but I still don't get it. (I'm very new to Revolution..)

I've created a library stack called libRPG where I've put one function at the moment. My problem is that I can't get my application stack to use it. They're both in the same directory and I've tried using: start using stack "libRPG" and start using stack "libRPG.rev" in the application stack's preOpen handler. The only thing that happens is that I get an error that Rev can't find the object. Obviously I'm misunderstanding something here. Do I have to "import" the stack to my application? If so, how do one import other stacks? I read somewhere that you can use other stacks (that's not in the application) if you supply the filepath but I can't figure out how to do this..

Thanks,

Fredrik

Posted: Mon Oct 20, 2008 8:29 am
by SparkOut
I think if you're working in the IDE then the default location for the "start using" will be relative to the engine location, not the application mainstack, so you'll need to set the folder path for it to find the library stack.
If you have both the application and the library open in memory then in the property inspector for the library stack, under the stack name and title you can select the mainstack. (Or for that matter, in the message box type "set the mainStack of yourLibraryStackName to yourMainStackName".) That will set the library stack as a substack of your application stack and the relative path issue should be resolved.

Posted: Mon Oct 20, 2008 8:49 am
by morbug
Thanks!

It works when I use the absolute path to the library. Do you have any thoughts on what's the best way of using libraries in stand-alone applications? Including them as a sub stack?

Posted: Mon Oct 20, 2008 9:16 am
by SparkOut
That's my personal preference, yes. For a standalone though, the relative path will be from the application mainstack, so you can decide as you see fit.

Posted: Mon Oct 20, 2008 5:57 pm
by morbug
Thanks again! It looks like a lot less hassle to use the libraries as sub stacks and since I actually got it to work I think I'll use that method.