[NTLK] NS Question: how to access slot in parent frame

From: Jim Witte (jswitte_at_bloomington.in.us)
Date: Sun Mar 24 2002 - 01:11:19 EST


   Well, my current assignment is to write a Calculator applet in Java.
I was planning to hack up the same thing in NewtonScript in about an
hour, to show how much quicker NS is.. Well, that never happened..

   But I did find one quirk/bug/oddity: I have a base protoFloatNGo
("base") and a clParagraphView ("display") which is declared in the base
view. The base view's viewSetupFormScript calls a method in "display"
which then sets a slot in "base". Here's the code:

base :=
     {viewSetupFormScript:
        func()
        begin
                display:updateDisplay();
        end,
      currentDisplayNum: nil,
      debug: "base",
      _proto: @180 /* protoFloatNGo */
     };

display :=
     {updateDisplay:
        func()
        begin
                base.currentDisplayNum := 0;
        end,
      debug: "display",
      viewClass: 81 /* clParagraphView */
     };
AddStepForm(base, display);
StepDeclare(base, display, 'display);

with the minutiae concerning viewBounds and whatnot removed. When I run
it, it tells me that the variable 'base' is undefined in updateDisplay.
Of course it is, it's not a variable. Then I chage
base.currentDisplayNum to parent.currentDispalyNum, and it tells me
"Object {class: <an immediate>, funcPtr: 7037727, numArgs: 0} is
read-only / evt.ex.fr;type.ref.frame / -48214" Anyone have any idea
what's going on here?

Jim

-- 
Read the List FAQ/Etiquette: http://www.newtontalk.net/faq.html
Read the Newton FAQ: http://www.guns-media.com/mirrors/newton/faq/
This is the NewtonTalk mailing list - http://www.newtontalk.net



This archive was generated by hypermail 2.1.2 : Tue Apr 02 2002 - 14:03:29 EST