Using Newt

Getting Started

Where to Find Newt, Sloup, NewtATut, NewtTurT,

Presumably, you have already located this page or obtained Newt. My Newton page has the most current information about versions.

Installation

Exploring Newt's Application Personality

Try the following (see also the NewtATut interactive tutorial). You should have NewtPack installed (see packages.htm) if you want to be able to Save your application.

Hopefully, you have followed these steps correctly/successfully, and have a functioning application. If you have NewtPack installed and your application is visible,

If you have the sources for an application in the current folder (transferred via Sloup, or copied from NewtATut), you can rebuild the application later from these sources by Evaluating the expression: :doObj('build, 'myApp)

(The 2nd arg is the app symbol -- first line of application object definition).

Exploring Newt's Turtle Personality

This is described in turtle.htm and requires the NewtDraw plugin to be installed; also see NewtTurT tutorial book

Interface Guide

The following sections cover the major interface areas of Newt -- the views available by tapping overview (the dot between the two fixed scroll arrows at the bottom of the screen).

Main View (Edit Objects/Methods)

This is the initial screen where you browse and edit objects and methods. Other views (windows) are used for drawing, printing, building applications, and as control palettes.

overview
Tap the overview dot (between the fixed scroll arrows at center bottom) to pop up a list of current views, containing built-in views such as About Newt, and Eval Log, palettes such as Eval Controls, related packages (if installed): Sloup, NTK Inspector, Newt's Cape, Newtworks (2.1); any user-created applications, e.g., Hello World. You can also add NTK apps/books to this list. If you have installed plug-ins such as NewtDraw, other entries may appear.
scroll arrows
In Edit Methods (Main View) or Eval Log (if visible), the main text field scrolls.
folder tab (top of screen)
Newt uses the folder label for organizing "newts" for Save in Edit Methods (Main View), Eval Log, and About Newt (and Newt Drawing, if installed). Newt "compiles" (i.e., makes an executable version of) methods and checks objects found in the current folder, and notes errors (if any) in Eval Log. This should include "local" Notes folders, and be compatible with SuperNotepad and MoreFolders.
drag dot (top center)
drag Newt application on larger screens (e.g., MessagePad2000, eMate300)
source names
The name of current object, method or page appears in a "picker list", preceded by a diamond. (Status messages may appear here also). more details
action button (routing/envelope icon)
You can Save and Revert, Duplicate, Delete current source. You can also copy templates from a library folder -- see later action button descriptions. Newt does not currently provide a filing button -- however, you can look at, reorganize, print, fax, beam etc. your saved newts (source, screen snapshots, print results, registration form) outside Newt in the generic Notepad application.

We will now cover the other palettes and views, and return to editing and creating methods later under Edit Methods (continued).

Eval Controls

The following controls are found in a floating, draggable palette, located initially at the bottom of Newt's screen: Eval field, Expr, keyboard icon, Eval button, Print?, and Save. As a general rule, you will want to keep Eval Controls visible, rather than closing and re-opening it.

Eval field
This field can contain a short program in NewtonScript. Tap the Eval button to execute it. Techniques for entering/editing expressions include combinations of handwriting, soft and hard keyboards, copy&paste, Expr list, MetaDot context-sensitive popups, custom control panels (e.g., NewtDrawing), Newt books (e.g., NewtATut), code libraries (other folders, etc.)
Expr
A popup list of sample expressions appears -- you can customize this via comments after the header line. If you select an expression, it appears in the Eval field. You can then edit it, and/or tap the Eval button to execute.
keyboard icon
this is hidden for 2.x if a real keyboard is connected. This toggles (either shows or hides) a floating alphanumeric keyboard (on 1.x, this does not prompt for additions to the dictionary; you can double-tap in the Eval field for the standard (prompting) keyboard).
Eval button
Tap the Eval button to evaluate (compile and execute) the expression in Eval field. The button remains highlighted during execution. (During interruptible methods, e.g., squiral2, it changes to Stop and you can tap it to terminate execution.) If you spell something incorrectly, or use incorrect parameters or syntax, Eval Log (or a system error box) will appear with a somewhat cryptic error message or code (see Errors). You can add additional error messages via the ErrCnst plug-in. Basically, you will have to compare what you wrote more carefully against the example, edit it and try again. (Other info and examples available to registered users).

Warning: Neither Newton nor Newt provide a general interrupt capability . So, unless you like using the manual reset button in the back, use common sense in choosing values for iteration, recursion or distance that are not "too large" . I will generally provide some reasonable values to try. Newt's default behavior is to finish executing the entire expression before checking for user actions like button taps. There is a facility provided in Newt to replace the NewtonScript "for" iteration construct. This facility executes each step in the background, allows you to interrupt Newt, and is covered in the manual.

Print picker
(Eval Log)
if checked, blank if off. if on, displays "Eval Log" [clipped on portrait size]; the Eval Log view pops up with expression and results after you tap the Eval button. Error messages will appear regardless of this setting. If you have Sloup connected as an Inspector, print and error results appear in your desktop terminal emulator.
printDepth
global variable controls number of levels for printing; values 0-3 are provided; if a larger value is set, e.g., printDepth := 5, it appears at end of section.
printLength (2.x)
global variable controls number of items to print in an array or frame; values: nil,16,32,64,128 are provided; unlimited printLength can be selected via "infinity" (printLength); if a different value is set, e.g., printLength := 50, it appears at end of section. Notes: in earlier versions of Newt, this was just a checkbox for EvalLog, and printDepth variable was used (printLength was not checked); these values are also used by NTK; use large/unlimited values with caution; unless changed, the printDepth/printLength settings persist until reboot; these are not stored as a NewtDevEnv preference.
Heap
The first time you tap this, the Newton begins to display the amount of heap remaining, updating every ~10 seconds. If you tap again, it immediately does a "gc" (garbage collect) which should increase the number. To turn off, close Eval Controls, then re-open it from the overview menu.
Save
The current (top) view is saved, usually to the Notepad under the current folder tab category. For Edit Methods, the method source, if edited, is saved (same as Save under action button) if there are no errors. For About Newt, a text registration form is saved. For Eval Log, the current printed results are saved. For Newt Drawing, the current drawing, if any, is saved. A user application is saved either as a package if NewtPack is installed). If the view is not recognized as an "application", Newt beeps.

Newt Drawing

Newt Controls

About Newt

Select this via overview (or info button). Tap Save in Eval Controls to create a registration form in Notepad under the current category (see folder tab) for later printing, mailing, etc. Or, tap the $ button in order to register and pay electronically if you have the Register application.

Eval Log

See earlier comments under folder tab, scroll arrows, Print? and Save.

Sloup, NewtATut, NewtTurT, etc.

If Sloup is installed, it will also appear in the overview list. If you have started Newt from NewtATut or NewtTurT, titles for these books will appear here also. You can also add other NTK packages (apps and books) for convenience.

Your Applications

overview also contains the titles of applications you are currently developing within Newt, based on source methods. Once you Save the application as a package, it is available separately in Extras.

Edit Objects/Methods (continued)

We now complete coverage of the interface by revisiting the main view.

source names
A "picker" at the top preceded by a diamond contains methods, objects and pages defined in current folder (see folder tab). The diamond disappears during editing (see Save, Revert). Status messages for lengthy operations (Checking,Deleting, Copying) sometimes appear here. You can also select one of the "new" names at the top of the menu to create a default template.
source text
As in the Eval field, you can use handwriting, copy&drag and keyboards to edit your method, object or page source. You can insert parameters/slots for current functions/protos using MetaDot. You can change source name by editing. You can Save, Revert, Duplicate or Delete it via the action button on right. Conventions for different kinds of methods and objects and NewtonScript syntax described in the manual. Also look at graphic0.nwt and applic0.nwt for examples.
action button
Note: "..." after a command indicates that a popup menu or confirm dialog will follow. If command beeps, then it's probably illegal in current context -- you may need to do a Revert, or Select Library first.
Save
Assuming that the source name is valid, does not conflict with a pre-defined "system" method, and successfully compiles, the method source is saved (created or updated) as a "newt" (i.e., text Note) in the current folder. Errors, if any, are noted in Eval Log, with the line of source indicated by the error message. Newt saves only valid sources. So, if you cannot figure out a compile error from the cryptic message, you could either Revert to the earlier version, or comment out offending code (precede individual lines with //, or wrap a section with /* =lines of code= */), so that you can Save for now, get on with your life, and look at it later. Methods are defined immediately; other objects are only checked but can be added explicitly later, e.g., via :doObj.
Revert
If you have unsaved changes, the diamond in front of the source name disappears. Revert returns to the last version saved of the original method in the current folder, or to the basic template. If "do Confirm" preference is checked, it asks first.
Add(Obj)
If you have a source for an object in the editor, this adds the object to your application. If the first line is "myApp+aButton", this is equivalent to :doObj('add, "myApp+aButton"). (This assumes you've added "myApp" earlier.)
Build(App)
If you have a source for any object from an application visible in the editor, this does a build of your application (adds application and all of its child objects). If the first line is "myApp+aButton", this is equivalent to :doObj('build, 'myApp) -- it adds "myApp", then "myApp+aButton", etc.
Duplicate
This makes a copy of the current source. Give it a new name (no duplicate names allowed) before Saving.
Delete
Deletes current source from Notepad. It also deletes defined Newt method (if any) but does not delete objects from an application. No confirmation.
HyperLink
2.x: if HyperNewt is installed, saves a link to an application definition, e.g., myApp; tapping on this later in HyperNewt opens Newt (if installed) to the current folder of the definition and builds the application, e.g., :doObj('build, "myApp").
Delete All...
Deletes all current items from the current Notepad folder. It confirms first.
Reload Folder
this is useful if AutoLoad? is off -- in earlier versions of Newt, you had to select a different folder, then re-select original.
Select Library...
Pops up a list of available Notes folders, library plug-ins, e.g., applic0.pkg (you can create these library packages directly from Newt itself), Paperback books, and Personal Media workspaces.
Copy Source... (formerly "Copy from")
Pops up a list of available sources in current library/folder. Copies source for selection to the editor, using same name; change name if appropriate; to save to Notepad, tap Save. This could be useful for libraries of templates.
Copy All...
Copies all sources from current library to current folder. It confirms first. You may wish to do Delete All first.
Remove Package...
Pops up an alphabetical scrolling list of currently installed (but not built-in) packages. This can be convenient for getting rid of packages that you no longer need (note: if you delete any of Newt's plug-ins while in Newt, be prepared to quit immediately afterward; otherwise, you may encounter a memory error). If you attempt to save a package whose name (appSymbol) already exists, Newt will prompt you about removing it before proceeding.

Preferences

Newt saves your preferences for Print? and folder tab and others (including Pen, Color, Newt? for NewtDraw) in a small "system soup" frame that persists across Newt sessions. If you no longer need Newt, you can remove this preferences frame via a soup utility (like StewPot) or directly from Newt (evaluate EntryRemoveFromSoup(prefsEntry) just prior to exiting Newt).

Some preferences are available via the "i" (info) button. This is at lower left.

About
opens the About box
Prefs
autoLoad
automatically load(check) current folder when starting Newt
1.x: askWords
flag for DontAsk plugin
doConfirm
ask for confirmation for major operations (Copy All, Delete All, Revert)
closeConfirm
upon closing Newt
noConfirm
just quit (don't ask)
editedConfirm
ask only if current source has not been saved
alwaysConfirm
always ask
autoHeap
turn on the "heap" status (in Heap button) automatically
heapFreq
frequency (in milliseconds) for updating Heap status (if on)
newtFont
Espy(system) 9,10,12), Geneva (simple) 9,10,12; NewYork(fancy) 9,10,12; (2.x) Casual (handwriting) 9,10,12; changes font (but not viewLineSpacing) in edit area, Eval Log, and Eval Field
printRefresh
force screen refresh after printing of each item in Eval Log
Compile for debugging?
similar to NTK's setting; if this is on, it preserves DebuggerInfo slot in method objects, and adds a debug slot to child/proto objects. This will improve usability with NTK Inspector, as well as upcoming ViewFrame revision. Turn it off for a smaller package in finished applications.
viewSize
2.x. portrait or full screen size
menuFont
2.x. Espy (system) 9,9B,10,10B; change menu/width font used in editor, Copy Source. extra refresh occurs if font is not 9B
I paid?
if this is unchecked, this displays Newt's About box after startup; check it after you have registered to disable this
Smart Edit
If this is on and the MetaDot plugin is installed, you can tap on items (or type cmd-opt-.) in Newt's source code editor to view/paste/use information. The public plugin contains only 1.x proto, method, function information. For example, tap a
called function e.g., "StrPos(" or method e.g., ":slideEffect("
a list of parameters appears
unknown function or method, e.g., "?(" or method ":?("
a list of all functions (methods) appears
slot definition, e.g., "_proto:", "viewBounds:", "viewFlags:"
typical values appear
system proto or viewClass, e.g., "protoApp," or "clParagraphView,"
appropriate slots/methods and initial/default value appear

You can select an item to paste text into your source; or click outside the menu to edit normally; later, you will also be able to link to examples and documentation. If the popups become annoying, you can either turn off Smart Edit, or tap on whitespace to avoid triggering the pattern checker. You can undo a recent change via Undo; and of course, undo everything via Revert.

For example, assuming you have the myApp object (from NewtATut tutorial) selected, you could tap on "protoApp" in the first line of the definition to see what other methods or slots could be added; in myApp.myInputProto tap on viewFlags: to see current flag settings, and tap on StringToNumber to see name of parameter.

Rotate
2.x. rotate screen
Version
prints version information about Newt and plugins in Eval Log (and Sloup/NTK Inspector if connected). same as :version(nil)
keyboard icon
to the right of "i" in 2.x version (handy if Eval Controls is closed)

Other Applications

In Notes, you can select NewtDevEnv:Eval or :Add command in the action menu depending on context (expression vs. object/method).

In Newtworks, NewtDevEnv (cmd-!) item in Newtworks:Tools sends selected expression to Eval or entire document (object/method) to Newt to Add.

In HyperNewt, tapping a Newt link, opens Newt (if installed) to the current folder of the definition and builds the application, e.g., :doObj('build, "myApp").

If you used RUNewt earlier, this is no longer needed since Newt 3.0 -- so, you can remove the "RUNewt:TKnollSys" package. If you are careful, you can remove the "RUNewt:Apps:TKnollSys" soup, and the "RunNewtRun:TKnollSys" system preference with a soup utility.


Version 3.4. Last updated: Jan 1999