links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Distributing your application
Last updated at 7:43 am UTC on 8 November 2019
Video Tutorial. available here

Tested in Squeak 5.2

Short intro
Often I asked myself "How would I send a Smalltalk application to a friend?". Usually I run my programs on the servers so I was not in a hurry to discover this. A few days ago I decided it was time for me to dig up the answer. This tutorial collects my findings. After watching it, a Unix guy (as I am) can see clearly how to build a standalone application. I hope Apple and Windows guys will have the same feeling. It was a nice surprise to discover that, in many cases, I may be able to run my application also in the Web browsers using SqueakJS.


Extra content
To the viewer convenience I copy here the big block of code I run in my Workspace.

----- Modifications the are better done with the Browser -----------------
. Disable left and right click on World 
You need to modify the the World mouseDown event handler. One way is this:
PasteUpMorph#mouseDown: evt
  |xxx |
  "add the next line just under the local variable declaration"
   (self isWorldMorph) ifTrue: [ ^true ] . 
. Remove the Debugger, on error we want something to be printed in stdout and the program to quit.  
--- from [original code] ----
 ^ToolSet debugError: self exception
------- to [code we want to have] ----------------
 ^CommandLineToolSet debugError: self exception

------- Code to tun in the Workspace have soemthing minimal
         and prune unwanted features from the image ---------

" create the string"
(s := StringMorph new) openInHand.  
s color: (Color blue).
s contents: 'Hello World!'.
s heading: 30.

"create the push button"
(b := SimpleButtonMorph new) openInHand.
b label: 'Click me!'.
b actionSelector: #value.
b target: [s heading: (s heading + 5)].

" -- here starts the part of cutting and adaptin the image --"

"get the reference to the current workspace we may need this in future
  to auto-close the Workspace. "
thisWorkspace := PluggableSystemWindow allInstances detect:
	[ :x | (x model class = Workspace) and: [(x submorphs at: 1) hasFocus] ] .

"no mainbar"
TheWorldMainDockingBar showWorldMainDockingBar: false.
"no flaps"
Preferences setPreference: #showSharedFlaps toValue: false.
"disable user interrupt: Alt+."
Preferences disable: #cmdDotEnabled.
"don't warn if sources file was not found "
Preferences disable: #warnIfNoSourcesFile.
"don't warn if the changes file was not found"
Preferences disable: #warnIfNoChangesFile.
"modify the code that needs to be modified, see notes around this code, (above)"
Browser open.
"Se si inseriscono stringhe assicurarsi di selezionare 'be locked' con l'halo prima di togliere gli Halo.
"no halos"
Morph haloForAll: false.
"prune as much menu as you can"
Morph metaMenuForAll: false.
Preferences setPreference: #generalizedYellowButtonMenu toValue: false.

"IMPORTANT: save an image with the Workspace open, your way back to dev. world"
Smalltalk saveAs: 'app1-toShare-withWorkspace.image'.

"disable keyboard shortcuts e.g.: copy/paste/doIt/printIt
Preferences compileAccessorForPreferenceNamed: #cmdKeysInText value: false.

"save the image to share with others"
Smalltalk saveAs: 'app1-toShare.image'.

"now, last steps, IRREVERSIBLES
1] close this Workspace.
2] resize the window to the way you want your app to look
3] click the upper right corner to close the Window and SAVE !