Beeping Button Brouhaha
Undefined variable: numBeeps evt.ex.fr.intrp;type.ref.frame -48807 (#6008D229).buttonClickScript(), 3: Push 'text Entering break loop: level 1This is the exact same error at the same place we had it before. Let's check the floatNGo view again:
beepingButton := GetCurrentReceiver(0); floatNGo := beepingButton._parentand here is what we find when the Inspector returns our result:
#4412B0D {_parent: {minute: 181, downButton: {#440B129}, calculator: {#4406159}, mailEditor: {#44064A1}, extrasDrawer: {#4409651}, defaultTransport:Newton: {#4405DD9}, OutOfMemoryAlert: {#4405D95}, notification: {#4405D35}, remindSlip: {#44060C5}, namesButton: {#44063D9}, folderEdit: {#4405DF1}, phoneKeyboard: {#4405ECD}, ovButton: {#440643D}, upButton: {#440EF4D}, thegang: {#44065D9}, printerSerialPicker: {#4405D05}, ...}, _proto: {viewBounds: {#6008D1F1}, stepChildren: [#6008D211], _proto: {@180}, debug: "myFloatNGo", numBeeps : NIL, stepAllocateContext: [#6008D731], appSymbol: |Demo:NTK.Demo|}, viewCObject: 0x1108C2C, numBeeps : {_parent: <2>, _proto: {#6008D5D1}, viewCObject: 0x1109F0C, entryLine: {#4419229}, labelLine: {#4418E49}, width: 73, indent: 75, height: 13}, viewclipper: 17863746, base: <1>, viewFlags: 577}The
numBeeps
slot seems to be there and seems to point to what looks like it could be our view. Let's try to access it from the Inspector:
floatNGo.numBeeps #2 NILThat doesn't make sense. We can see that it is there. Let's try another way to get to that view using the
Debug
function:
Debug("numBeeps") #2 NILCuriouser and curiouser. However, look very closely at the way the
numBeeps
slot prints out versus any other slot:
_proto: {viewBounds: {#6008D1F1}, stepChildren: [#6008D211], _proto: {@180}, debug: "myFloatNGo", numBeeps : NIL, stepAllocateContext: [#6008D731], appSymbol: |Demo:NTK.Demo|}, viewCObject: 0x1108C2C,
numBeeps : {_parent: <2>, _proto: {#6008D5D1},Other slots have no space before the colon (":"), while the
numBeeps
slot has one space there. Could this have anything to do with our problem? What if that space were significant? Let's try calling Debug
with an extra space after numBeeps
:
Debug("numBeeps ")and here is the Inspector return result that we get:
#4418AF5 {_parent: {_parent: {#4412B25}, _proto: {#6008D0C1}, viewCObject: 0x1108C2C, numBeeps : <2>, viewclipper: 17863746, base: <1>, viewFlags: 577}, _proto: {viewBounds: {#6008D681}, label: "Num Beeps:", entryFlags: 10753, _proto: {@189}, debug: "numBeeps ", preAllocatedContext: |numBeeps |}, viewCObject: 0x1109F0C, entryLine: {_parent: <2>, _proto: {#356429}, viewCObject: 0x110A83B, viewFlags: 10753, viewBounds: {#4418F4D}, text: "2"}, labelLine: {_parent: <2>, _proto: {#356569}, viewCObject: 0x110A871, text: "?Num Beeps:", viewFont: {@100}, viewBounds: {#4418E2D}}, width: 73, indent: 75, height: 13}So if it acts as though the name had an extra space--maybe it does. Let's check the Template Info dialog for that template more carefully (see FIGURE 8.20). Indeed, there is a trailing space after
numBeeps
. We'll delete it and rebuild.
FIGURE 8.20 : Template Info dialog for numBeeps with an extra space at the end.
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996