Examples
1. Create a new project file named "BeepingButtonProject". Use the New Proto Template menu to create a new user proto. Within the user proto, draw out a protoTextButton (see FIGURE 7.9).
FIGURE 7.9 : User proto containing a protoTextButton template.
buttonClickScript
of the user proto to:
func() begin :SysBeep(); end;3. Save the user proto as "BeepingButton" and add it to the project (see FIGURE 7.10).
FIGURE 7.10 : BeepingButton proto file in the project.
5. Select BeepingButton from the palette (see FIGURE 7.11) and draw one out within the protoApp. Notice that regardless of where you draw it out, it appears in the same location where it was originally created in the proto (see FIGURE 7.9).
To fix this, delete the beeping button template you just drew out and edit the beeping button proto. Remove the viewBounds
slot (since the template will provide one). In addition, remove the text
slot (again, the template will provide one). We end up, then, with only two slots: _proto
and buttonClickScript
. This makes sense because our beeping button is exactly like a protoTextButton, except that it has a buttonClickScript
which beeps.
6. Go back to the protoApp and reselect BeepingButton from the palette, and draw one out. Now it appears in the location where you drew it out.
7. Draw out a second one. Make the text
slots different in each button template.
8. Build and download. Tapping on each button should make the Newton beep.
FIGURE 7.11 : Choosing BeepingButton from the palette.
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996