This document describes how to set up and use DyneTK to make packages for use with NSM.
Download DyneTK from https://code.google.com/p/dynee5/downloads/list and use the installer for your platform.
Make sure you follow these steps exactly. Because DyneTK is not finished yet, there are some bugs which can cause it to crash if you do things in the wrong order.
First, choose "New Project..." from the Project menu. You will be asked to provide a filename for the project file. The name will also be used for the package file produced by the project. For example, a project file called something.ntk will produce a package called something.pkg.
Next, choose "Settings..." from the Project menu. On the Package tab, give your package a unique name. NSM does not currently make use of it, but it might in the future.
Then, choose "New Layout" from the File menu. A tab, by default called layout.lyt, will open. A NSM package would usually be an auto part (just code with no graphical user interface), but DyneTK can currently only create form parts (applications for Newton OS with a graphical user interface), so NSM supports form parts of a special format so DyneTK can be used. However, this does not mean you can just create graphical applications and expect them to work; only this specific case is covered.
We will need to create a dummy view (user interface component) that will contain the code that NSM will run. The actual view will be unused. To do this, choose "Open Layout" from the Window menu. An empty window resembling a Newton screen will open. Click the "Create Proto" button on the main window's toolbar (its icon is a green disc with a white plus sign on it) and choose "clView" from the drop-down list on its right. Then, drag anywhere in the layout window to create the view. You will see a "clView" entry appear in the list of views in the main window.
You can now close the layout window, as you will not need to use it ever again. Click on the "clView" entry in the list of views to select it. Choose "New Slot..." from the Browser menu. A window will open. Name the slot "_NSMInstallScript". Click "Add" to add it, then "Done" to close the slot adding window.
You can now finally start writing the actual code into the slot. As an example, we are going to use this:
This function will be executed when the package is installed (loaded). The removeFrame parameter is an empty frame to which you can add slots. The frame will then be passed as the parameter to the _NSMRemoveScript function in your base view when the package is removed (unloaded).
As a final step before compiling, you need to add the layout file to the project. To do this, choose "Add Window" from the Project menu. You will be asked to provide a name for it.
To compile, choose "Build Package" from the Project menu or press Ctrl+1. A package will be produced in the directory of the project file with the same name as the project file.
If there was an error, the Inspector window at the bottom should tell you what is wrong.
You can then use NSM to run the package. See the NSM manual for instructions.