SuperCard Programming/Tips & Tricks/Stacks as document templates
Stacks as documents
One approach is to store your template as a user prop and write it out when you need a new document.
storeDoc below is run once when you are preparing your application:
on storedoc answer file "Choose a template to use:" if it is "" then exit storeDoc put it into tFile open file tFile read from file tfile until end close file Tfile define the UDoc of this proj set the uDoc of this proj to it end storeDoc
newDoc when you want a new document:
on newDoc ask file "Name your doc:" if it is "" then exit newDoc put it into tFile put the fileType into toldType set the fileType to RUNXMDOX --Or your standalone's creator and file Type open file tfile write the uDoc of this proj to file tfile close file tfile set the fileType to toldType set the itemdel to colon put last item of tfile into tWindowName set the name of wd 1 of proj tFile to tWindowName open proj tFile end newDoc
With bundled apps it would also be possible to just store a template somewhere in the bundle and copy it out when you need a new project.
Obviously things can get a bit more complex if you want to open an untitled document which works like a standard document and needs to be explicitly saved.
Keith's update of Graham Samuel's notes on standalones useful: []Last modified on 3 March 2008, at 02:37