
NewtonScript Examples
An Application That Prints "Hello world" to the Inspector
A QuickTime movie of this example is available, as is the completed project for different platforms (Mac OS, Windows 3.1 or Windows 95/NT). In NTK, create a new project file. Then, create a new layout file. Within it, draw a protoApp. Within the protoApp, draw a protoTextButton. Save the layout file as "Main" and add it to the project (see FIGURE 3.5). Create a browser window for the protoApp in "Main" and edit the buttonClickScript
slot of the protoTextButton (see FIGURE 3.6). You will then need to make the contents of the buttonClickScript
read as follows:
func()
begin
Print("Hello, world");
end;

FIGURE 3.5 : Layout file "Main" added to the project.

FIGURE 3.6 : Editing the buttonClickScript
slot of the protoTextButton.
Build, download, and run the application. When you click on the button, it should print the following to the Inspector:
"Hello, world"
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996