Stacks and Sub Stacks

Peter Bogdanoff bogdanoff at me.com
Wed Sep 25 15:46:56 EDT 2019


Mark, you can easily use the send command for this. There is also the dispatch command. The call would go directly to the object, bypassing any hierarchy. Thus you can have the same-named handlers is other stacks without a conflict. Sometimes it is a good thing to have a same-named handler in various stacks. For example, if you have multiple stacks for data entry and you want to initialize the fields in the various stacks, you could:

# Where tStacksToInitialize is a list of stacks
# Each stack contains a handler emptyFields that knows exactly which fields to empty

repeat for each line tLine in tStacksToInitialize
    send emptyFields to stack tLine
end repeat

Peter Bogdanoff
ArtsInteractive

> On Sep 25, 2019, at 12:06 PM, Mark Smith via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Do you ever have to call a substack from a main stack? If you do, do you have to preface the handler with a substack reference or does LC know where to look? Can you have 2 handlers by the same name in different sub stacks? How about in the main stack and a substack (that would really get confusing). Any recommendations on what NOT to put in a substack?
> 
> Thanks
> Mark
> 
>> On Sep 25, 2019, at 2:54 PM, dunbarx--- via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> Hi.
>> You probably mean script-only stacks.
>> Substacks are just stacks, but they live in the same file as the mainStack. It helps with organization, and when you save one, you save them all. You can only have one mainStack, but as many subStacks as you like.
>> For me, I have projects that use substacks for, say, data entry. The subStack is built just for that purpose.
>> When making a standalone, substacks are included in the final package.
>> Just practice a bit. 
>> Craig
>> 
>> -----Original Message-----
>> From: Patrick Roza via use-livecode <use-livecode at lists.runrev.com>
>> To: use-livecode <use-livecode at lists.runrev.com>
>> Cc: Patrick Roza <patrick.roza at gmail.com>
>> Sent: Wed, Sep 25, 2019 9:18 am
>> Subject: Stacks and Sub Stacks
>> 
>> Looking for some good examples of the Main stack used with sub stacks.
>> Looking for best practices on usage. Also using text-only stacks.
>> 
>> Thanks,
>> 
>> Patrick
>> _______________________________________________
>> 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
>> _______________________________________________
>> 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
> 
> 
> _______________________________________________
> 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