Opening a Stack from the Server
This lesson shows you how to open a stack from a server using a desktop based standalone. This technique means you can download data to your application temporarily, administer updates to all your users via the server stack, or connect to other users by using a common stack from the server. It can also be used to reduce the standalone size and for a variety of other purposes.
Step 1: Create the Standalone Launch Stack
From this launch stack, we call the Main Application from the server using this code
on mouseUp
go stack url "http://path/to/your/server/MainApplication.livecode"
end mouseUp
Step 2: Creating the main stack which will be opened from server
This is the Main stack which is uploaded to the server. Here we can also get the image from the server using on openCard:
on openCard
set the filename of image "city" to "http://path/to/your/server/edinburgh_004p.jpeg"
end openCard
Please Note: This should be uploaded as a normal LiveCode stack and not as a standalone.
Step 3: Save the Launch stack as Standalone
Step 4: Upload the Main stack and Image to the server
As you can see we have uploaded the raw LiveCode file.
Step 5: Running the Standalone to get the stack from the server
Once we click the button "Get data from Web" the Main stack is opened.
That's it! Pretty simple, but a very useful technique to know.
Torsten
This functionality is great!!!
Unfortunatly it has problems if the server stack contains the browser widget. This widget is not visible if you load the stack from a server.
Is this a bug or a technical feature?
Cheers, Torsten
Elanor Buchanan
Hi Torsten, it should work, I did a quick test here and it seemed to be ok.
Can you let us know what version of LiveCode you are using and what OS you are on? I tested in 8.1.6 on Mac, just a simple stack with a browser widget with a URL set on it.
Thanks
Elanor
Torsten
Indeed, now it works :-)
That's very fine, it opens up a great amount of opportunities for the flexible distribution of stacks!
Did you know if this mode works also on mobile platforms?
Cheers, Torsten
Torsten
Correction to my last post about successfull testing of the Browser-Widget stack:
It works only if you start the "go to stack" command in the LiveCode IDE.
If you create a standalone (tested on Mac and Windows), the called stack does NOT show the browser widget.
Torsten
I find out, how to make it!
The reason why it did not work the first time is because the widget was not present in the starter application.
When building a standalone app, Livecode does not integrate the code of widgets which are not used in the standalone app.
If you need widget code in the server stacks, you have to put the widgets into the starter app (somewhere hidden if not used actively).
This way it is possible to start server stacks with all available widgets :-)