loading another stack from splash
Mark Smith
Mark_Smith at cpe.umanitoba.ca
Sat Oct 2 16:03:16 EDT 2010
Wow, very very cool. Thanks you for taking
the time to pass this along. Being able to keep the stacks inside the OSX application bundle will/would be fabulous.
-- Mark
(PS Its going in my RunRev er Livecode Gold folder!)
________________________________________
From: Sivakatirswami [via Runtime Revolution] [ml-node+2768466-1431577482-120797 at n4.nabble.com]
Sent: Thursday, September 30, 2010 5:23 PM
To: Mark Smith
Subject: Re: loading another stack from splash
On 9/28/10 5:11 PM, Mark Smith wrote:
> Also, it would be real nice not to have to "hard code" the path in case I
> want to change its location. Having to manage two stacks instead of one does
> seems like an added burden.
>
> Stumped. Any help appreciated
>
> -- Mark
We meaning many of us here... do this all the time.
I love keeping stacks inside the OSX application bundle,
you can develop them from inside there and ship as as single binary..
There are two common approaches These scripts may help
on loadFromDisk
-- Setting the default folder.
set itemdel to "/"
set the defaultfolder to item 1 to -2 of the effective filename of
this stack
-- Check for application
if there is not a file "MyNoteBook.rev" then
if checkNet() then
checkNetworkAndDownload #If you don't have it locally then
get it from the web server
exit loadFromDisk
else
answer error "Please connect to the internet to install
this application"
exit loadFromDisk
end if
end if
go stack url "binfile:MyNoteBook.rev"
hide stack "MySplashEngine.rev"
end loadFromDisk
---------
on preopenstack
go stack url (getPath("MyNoteBook.rev")
end preopenstack
function getPath tStack
set the itemdel to "/"
put the effective filename of this stack into tPath
put tStack into item -1 of tPath
return tPath
end getPath
By separating the function you have the interesting option of offering
the user the option to open any number stacks you might bundle into the
same folder:
On the splash screen you can have a pull down menu like this
on mousedown
set the defaultfolder to item 1 to -2 of the effective filename of
this stack
put the files into tFiles
filter tFiles with ("*.livecode")
put tFiles into me
end mousedown
on menuPick pStack
go stack url (getPath(pStack))
hide this stack # hide the splash screen now...
end menupick
Now you can put what ever stacks you like into that folder.
Don't forget to include quit handlers in all the stacks so that you
don't leave a hung process Hidden splash screen still running.
HTH
aloha
Mark assuming that you will always put the data stacks in the same
folder as the splash-engine stack
_______________________________________________
use-revolution mailing list
[hidden email]</user/SendEmail.jtp?type=node&node=2768466&i=0>
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
________________________________
View message @ http://runtime-revolution.278305.n4.nabble.com/loading-another-stack-from-splash-tp2547155p2768466.html
To unsubscribe from loading another stack from splash, click here<http://runtime-revolution.278305.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=2547155&code=TWFya19TbWl0aEBjcGUudW1hbml0b2JhLmNhfDI1NDcxNTV8MTc4NDM5NjU4NQ==>.
--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/loading-another-stack-from-splash-tp2547155p2952707.html
Sent from the Revolution - User mailing list archive at Nabble.com.
More information about the use-livecode
mailing list