Whoops: Getting the name of the script only stack an handler is in
William Prothero
waprothero at gmail.com
Mon Dec 31 18:15:39 EST 2018
Folks:
Ok, if there is a way to get the name of the stack containing a particular handler, I’ll use it. Otherwise, each “feature” stack will return a precoded name. I had to fiddle to get the polling to work without errors.
The impetus for this is to re-factor the code for a project that’s looking increasingly complicated, so I need to make sure I will be able to maintain it without chaos, and thanks to Andre’s book for some direction.
local actionsList
on actionsList tList
put tList&cr after actionsList
end actionsList
—call this in the openstack handler
on pollTheActionsStacks
put "" into actionsList
dispatch “pollActions"
end pollTheActionsStacks
—Each script only stack contains this:
—The name returned is set for each “feature” stack. I’d rather have it return the name of the “Feature” stack, but just
— returning the name is ok too
on pollActions
put the short name of this stack into myAction
put "CP_handwriting" into myAction
dispatch "actionsList" to cd "Opening" of stack "CP_Main" with myAction
pass pollActions
end pollActions
Happy New Year,
Bill
> On Dec 31, 2018, at 2:48 PM, William Prothero via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> Folks:
> Sorry, I accidentally sent the email before finishing it. Here’s the complete message.
> But perhaps I’ve solved it. I only need to put the name of the “feature” stack in the pollActions handler. Anyway, I still have my question.
>
> I’m trying to implement a structure where I can simply add script only stacks that seamlessly add capability to my app. To do this, I have all of the “feature” stacks in a given folder, and when I initialize the app, I start using all of the “feature” stacks. Then I want to initialize all of them, so I send a message that gets passed in each “feature” stack.
>
> I do, in each “feature” stack (which doesn’t give me the answer I want):
>
> on pollActions
> put the short name of the current stack into myAction (I want the name of the stack that contains this script)
> dispatch "actionsList" to cd "Opening" of stack "CP_Main" with myAction
> pass pollActions
> end pollActions
>
>
> In the main stack, I have:
>
> local actionsList
>
> on actionsList tList
> put tList&cr after actionsList
> end actionsList
>
>
>
> My question:
> How do I get the name of the script only stack that holds the “Feature” code? The above code gives me the name of the main stack, which is not useful for my purposes.
>
> Best,
> Bill
>
> _______________________________________________
> 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