The LC way for code libraries?

Pete pete at mollysrevenge.com
Sun Apr 3 17:10:55 EDT 2011


Richard,
Thanks for reminding me of your article, lot of useful info in it.

I'm currently inserting the script of a button as a front script.  The
script contains handlers for some standard messages (eg mouseUp, menuPick)
that I need to grab before they on through the normal message path, but it
also includes some custom handlers I've written which don't correspond to
any of the standard messages.

Is there any advantage to restructuring this so that the standard message
handlers are inserted as front scripts but my custom handlers are used via
the "start using" mechanism (after moving them to a stack script of course)?

As far as building standalones, I currently set the stackfiles property of
my application's main stack to the stack file holding my handlers which
seems to work fine but I get the sense that you don't use the stackfiles but
load the library stack manually at run time. If so, what are the advantages
of doing it that way rather than using the stackfiles property?

Thanks,
Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Sun, Apr 3, 2011 at 6:57 AM, Richard Gaskin
<ambassador at fourthworld.com>wrote:

> Maarten Koopmans wrote:
>
>  What's a good way to create and store a non-UI code library in a LC
>> project (a.k.a. "business logic")? Say I'd want to implement a WebDAV
>> client, which is a back-and-forth kind of flow. Or anu other protocol
>> will do as a mental model....
>>
>>  Where would you store all the support functions for the protocol?
>> Right now I can only see this happening on the stack level, but there
>> I'm still fairly clueless.
>>
>
> If you think you'll be using such a library in other projects you'll
> definitely have an easier time reusing it as a library.
>
> You could embed the library as a substack, but then keeping it updated
> every time you enhance it is a drag, so I tend to prefer to keep libraries
> in their own stack files, loaded at startup from a folder named "Components"
> I keep at the same level as the executable.
>
> This article may help you get started if you haven't read it already:
> <http://www.fourthworld.com/embassy/articles/revolution_message_path.html>
>
> --
>  Richard Gaskin
>  Fourth World
>  LiveCode training and consulting: http://www.fourthworld.com
>  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
>  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>



More information about the use-livecode mailing list