Route Scripts
routeScripts
array found in the newtApplication proto. We can't just copy the array and put it in our template, unfortunately; the value of the routeScripts
slot in the newtApplication proto may change in future devices or system software.The first thing we'll do is store our route scripts in a different slot so the standard ones aren't overridden.
2. Rename the routeScripts
slot to extraRouteScripts
to avoid conflict.
3. We need a way to dynamically copy the routeScripts
array. We'll do that by overriding GetRouteScripts
in our newtApplication template. Our code will return a new array containing the elements from the routeScripts
array and the extraRouteScripts
array:
func(targetInfo) begin local orig := inherited:?GetRouteScripts(targetInfo); if not orig then orig := routeScripts; local n := Clone(extraRouteScripts); // append orig to n ArrayMunger(n, 0, 0, orig, 0, nil); return n; endNow when we build and download, we have the original Duplicate and Delete as well as the new Beep (see FIGURE 12.6).
FIGURE 12.6 : The Action picker after overriding GetRouteScripts
.
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996