Call commands from stacks?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Call commands from stacks?
I have a Livecode stack that I started copying chunks of code out of to use in a server script.
Problem is that I keep making changes to the code in the stack, and then I need to update the scripts.
Can I just include the stack and run commands out of it in a server script?
Problem is that I keep making changes to the code in the stack, and then I need to update the scripts.
Can I just include the stack and run commands out of it in a server script?
Greg (pink) Miller
MadPink, LLC
I'm Mad, Pink and Dangerous to Know
MadPink, LLC
I'm Mad, Pink and Dangerous to Know
-
- VIP Livecode Opensource Backer
- Posts: 9817
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Call commands from stacks?
Yep: "start using" to make all handlers in a stack available as a library works on servers as well.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Call commands from stacks?
Interestingly, it appears that the preOpenStack handler is *not* called when you "start using" a stack. I'm not sure at the moment if this is an oversight, if I'm expecting too much out of the server configuration, or if this is by design.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
-
- VIP Livecode Opensource Backer
- Posts: 9817
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Call commands from stacks?
Truemwieder wrote:Interestingly, it appears that the preOpenStack handler is *not* called when you "start using" a stack.
Since HCIL the message sent to a library brought into use is libraryStack.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Call commands from stacks?
Yeah. I'm now dispatching to my preOpenStack handler in the card script from the libraryStack handler in the stack script in order to get a frontscript in play. I know startup will get called instead of preOpenStack in standalones, but I rather expected that the server would call preOpenStack when launching a stack. Makes it slightly harder to get a one-size-fits-all stack that works with either the desktop or server engines.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
-
- VIP Livecode Opensource Backer
- Posts: 9817
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Call commands from stacks?
If the stack is a library "libraryStack" should be automatically called in either Server or the desktop when the stack is brought into use.mwieder wrote:Yeah. I'm now dispatching to my preOpenStack handler in the card script from the libraryStack handler in the stack script in order to get a frontscript in play. I know startup will get called instead of preOpenStack in standalones, but I rather expected that the server would call preOpenStack when launching a stack. Makes it slightly harder to get a one-size-fits-all stack that works with either the desktop or server engines.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Call commands from stacks?
Richard- yeah, I realize that, but what I was trying to do in this case is launch a stack created with the IDE. If it were just a library I would have made it a script-only stack. The stack does have a button whose script gets installed as a frontscript, and I have been using the preOpenStack handler to insert the script when the stack is launched in the IDE. So now for the server I have added
Code: Select all
on libraryStack
dispatch "preOpenStack" to card 1 of me
end libraryStack
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev